Meaningless Drivel is fun!*
The moose likes Struts and the fly likes how to display the preselected item in the html dropdown as unselected. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to display the preselected item in the html dropdown as unselected." Watch "how to display the preselected item in the html dropdown as unselected." New topic
Author

how to display the preselected item in the html dropdown as unselected.

antsi klando
Ranch Hand

Joined: May 10, 2011
Posts: 46
Hi,

I am using struts framework which requires struts-html tags to be used for constructing the JSP.

In a form,say [product.jsp] if an item is selected from the dropdown and then submitted,the same product.jsp page gets loaded with some additional informations .The dropdown displays the selected item as highlighted as it was before submitting.How to show the same page with the item as unselected after submitting the form?

Since the struts-html tags are used,<html:select> and <htmlptionsCollection> must be used.Should the code in JSP be changed or the action classes?

Thank You..!
Nitin Surana
Ranch Hand

Joined: Jan 21, 2011
Posts: 129

All you have to do is set the value of the select as null within the action.

For e.g.
in JSP



in MyAction.java

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to display the preselected item in the html dropdown as unselected.
 
Similar Threads
How to select a value in the drop down list with value getting from database?
Dropdown Selected returning unexpected value on submit.
Capturing Dropdown values in Webwork
Struts and JSP problem
Repopulating form problem