?
Solved

request parameter value

Posted on 2008-06-09
2
Medium Priority
?
763 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1500 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This is a fine trick which I've found useful many times, when you just don't want to accidentally run a batch script or the commands needs administrator rights.
An introduction to the wonderful sport of Scam Baiting.  Learn how to help fight scammers by beating them at their own game. This great pass time helps the world, while providing an endless source of entertainment. Enjoy!
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month9 days, 7 hours left to enroll

762 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