File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How to retain the selected values in the drop down on submit