Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Aparna Sudhakaran
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
Java MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic