This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSP and the fly likes Unable to retain Dropn down values after submitting form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Unable to retain Dropn down values after submitting form" Watch "Unable to retain Dropn down values after submitting form" New topic
Author

Unable to retain Dropn down values after submitting form

Diptee Bhakre
Greenhorn

Joined: Apr 06, 2010
Posts: 2
Hi All,

I am not able to retain drop down values after submitting form in my jsp.
My jsp is as follows.

<form name="branch" target="_top" action="" method="get">
<select name="searchDropDown" id="br">
<option value="Select Entity to search">Select Entity to search</option>

<option value="MN">main</option>
<option value="EX">examples</option>
<option value="TR">training</option>
<option value="IC">content</option>
<option value="EU">europe</option>
</select>
<input type="text" name="searchText" value="<%=searchText%>" />
<input type="submit" name="submit" value="submit" onClick="validate();"/>

I am able to retain my text box value. But unable to do so for dropdown "searchDropDown".

Thanks in advance.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please UseCodeTags when posting code or configuration. Unformatted code and configuration is unnecessarily difficult to read.

What do you mean, "retain"? You have no code that would re-select any options; you use a value for the text. Options won't magically select themselves!
 
 
subject: Unable to retain Dropn down values after submitting form