This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Struts and the fly likes individual choice in combobox with struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "individual choice in combobox with struts" Watch "individual choice in combobox with struts" New topic

individual choice in combobox with struts

Dan Pan

Joined: Apr 30, 2003
Posts: 1
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();
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"/>
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..
Junilu Lacar

Joined: Feb 26, 2001
Posts: 5515

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.

Junilu - [How to Ask Questions] [How to Answer Questions]
I agree. Here's the link:
subject: individual choice in combobox with struts