File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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

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