Solved

request parameter value

Posted on 2008-06-09
2
760 Views
Last Modified: 2011-10-03
Hi All,
I have a drop down as shown below in my jsp.
<form = "form1">
<select name="sel1">
<option value="100">CA</option>
<option value="101">NJ</option>
<option value="102">WI</option>
</select>
<input type="submit" value="submit">
</form>

after  selecting a value and then if I submit my form using "submit" button,
and then if I use <=request.getParameter("sel1")%> ,
I am 100 or 101 ,
instead if I want to get the text i.e CA,NJ  etc.. ,
how to proceed ?
Thanks in advance.
0
Comment
Question by:prk_usa
  • 2
2 Comments
 
LVL 27

Expert Comment

by:mrcoffee365
ID: 21747884
You have to give the value you want in the value attribute of the option tag, like this:

<select name="sel1">
<option value="CA">CA</option>
<option value="NJ">NJ</option>
<option value="WI">WI</option>
</select>

If you're saying that you actually want both "CA" and "100" then you have to have both values in the value attribute, maybe something like :

<option value="100-CA">CA</option>

then in your code parse out the 100 and the CA values from the single string in the request parameter.
0
 
LVL 27

Accepted Solution

by:
mrcoffee365 earned 500 total points
ID: 21747896
I see you have a lot of questions open -- you haven't awarded points to anyone on 16 previous questions.  That might be why it took so long to get an answer to a relatively easy question.
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Exception creating bean of class 5 205
jersey maven project error 7 142
Java Script nested call 3 87
Suggestion on WebSite Template Sites 6 108
In case you ever have to remove a faulty web part from a page , add the following to the end of the page url ?contents=1
There's a lot of hype surrounding blockchain technology. Here's how it works and some of the novel ways it' s now being used - including for data protection.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question