Solved

request parameter value

Posted on 2008-06-09
2
762 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 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

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

We take a look at some of the most common obstacles that IT teams run into as they work relentlessly to keep all the alarms and sirens from going off at once.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

717 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