Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
antsi klando
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 129
Java Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic