| Author |
Getting drop down value in JSP as request scope.
|
amarshi mohanty
Ranch Hand
Joined: Jul 01, 2008
Posts: 110
|
|
Hi,
In my jsp , i have a drop down box , which on select i am submitting the page.After submitting the page , i am dispalying the same page with the output based on the slectected value from the drop down box.
But after the page submitted the , selectd value from the drop down box is not shown , rather the first value in the drop down box is displayed by default.
So when i am submitting the page , i am putting the selected value in request scope .
Then in the jsp , i am using the below code in selected options as:
but it not working.
what will be correct code?
--- Amarshi
|
SCJP (97%), SCWCD (95%))
|
 |
Sagar Rohankar
Ranch Hand
Joined: Feb 19, 2008
Posts: 2896
|
|
Try this:
|
[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
|
 |
amarshi mohanty
Ranch Hand
Joined: Jul 01, 2008
Posts: 110
|
|
This shows 5 as always selected.
|
 |
Sagar Rohankar
Ranch Hand
Joined: Feb 19, 2008
Posts: 2896
|
|
You have to play around.
Try,
Also, whether to use "5" or 5, depends upon the type of "docsPerPage".
|
 |
Mark E Hansen
Ranch Hand
Joined: Apr 01, 2009
Posts: 639
|
|
amarshi mohanty wrote:Hi,
In my jsp , i have a drop down box , which on select i am submitting the page.After submitting the page , i am dispalying the same page with the output based on the slectected value from the drop down box.
But after the page submitted the , selectd value from the drop down box is not shown , rather the first value in the drop down box is displayed by default.
So when i am submitting the page , i am putting the selected value in request scope .
Then in the jsp , i am using the below code in selected options as:
but it not working.
what will be correct code?
--- Amarshi
Did you look up the format for the <option> tag in HTML? You're not formatting it correctly.
For example, here's one description of the <option> tag: http://www.quackit.com/html/tags/html_option_tag.cfm
Then, look at the source of the response sent to your browser. Does it look right? If not, you should know how to correct the JSP now.
|
 |
 |
|
|
subject: Getting drop down value in JSP as request scope.
|
|
|