aspose file tools*
The moose likes JSP and the fly likes How to retain the selected values in the drop down on submit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to retain the selected values in the drop down on submit" Watch "How to retain the selected values in the drop down on submit" New topic
Author

How to retain the selected values in the drop down on submit

Aparna Sudhakaran
Greenhorn

Joined: Nov 23, 2011
Posts: 6
Hi,
I have a JSP page with two drop downs. i select values from them and click the submit button. on submit my page loads back with the google map plotting some points. that is working fine. However i want the drop downs to retain the values that have been selected on the result page as well.. how do i do that?
Harshavardhan Joshi
Greenhorn

Joined: Sep 27, 2011
Posts: 7

You must be getting that selected value on the result page after the submission.
Just change the <option>Your_Previously_selected_Value</option> to <option selected="selected">Your_Previously_selected_Value</option>.
If you are using <option>val</option> in a loop then you have to place a check.

Hope it will help.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to retain the selected values in the drop down on submit
 
Similar Threads
Drop down in jsp
Form Beans and retaining values
ajax dynamic combo
How can code the selected value in the JSP
Can I access the value of a listKey in <s:select> from my Action Class?