Solved

request parameter value

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

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
Lamba in java 8 9 259
best tutorial on log4j and logging for servlets/jsp codes 1 68
JSONSerializer.toJSON in JSP generating error 8 100
ArrayList Adding/settign data 3 36
A lot of things can happen during a presentation, worst of which is “death by PowerPoint.” Here are a few mistakes to avoid to make your slides clean.
A big percent of today’s marketing activity is performed through the online environment. The marketing strategies that have existed a decade ago no longer relate to what’s happening today. We’re currently facing a revolutionary era, called the digit…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

739 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