• Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting drop down value in JSP as request scope.

 
amarshi mohanty
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this:

 
amarshi mohanty
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This shows 5 as always selected.

 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to play around.
Try,


Also, whether to use "5" or 5, depends upon the type of "docsPerPage".
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!