Solved

request parameter value

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

Expert Comment

by:mrcoffee365
Comment Utility
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 26

Accepted Solution

by:
mrcoffee365 earned 500 total points
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
maven scope 1 120
library class in java 1 89
immutable object concept 5 104
maven j2ee examles 2 43
Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
A safe way to clean winsxs folder from your windows server 2008 R2 editions
This video discusses moving either the default database or any database to a new volume.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now