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

individual choice in combobox with struts

 
Dan Pan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Guys..
i have a problem here..
i have a vector where i put into all my choices for the combobox...
---
Collection repGroups= new Vector();
while(transManager.fetch(repGroup)){
repGroups.add(new LabelValueBean(repGroup.getGnam()+"-"+repGroup.getCpt(),""));
}
---
then i create the combobox as seen below...
---
<html:select property="rgid" >
<html ptions collection="repGroups" property="value" labelProperty="label"/>
</html:select>
---
now i want an alternative for the "selected" tag in the "<option...>" how it was done with the normal html code..
i would like to know how i can set the combobox to a individual choice when using struts..
something with the properties?
anyone has an idea?
Thanks in advance for valuable answers..
i count on you..
Daniel..
 
Junilu Lacar
Bartender
Posts: 7466
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your case, you need to set the rgid property in your ActionForm to the value that you want initially selected. The struts tag will automatically add "selected" in the generated HTML when the rgid value matches an option value.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic