GeeCON Prague 2014*
The moose likes Struts and the fly likes populating a select box from a collection within a collection in actionform Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "populating a select box from a collection within a collection in actionform" Watch "populating a select box from a collection within a collection in actionform" New topic
Author

populating a select box from a collection within a collection in actionform

sushilkumar jamesbond
Greenhorn

Joined: Aug 20, 2005
Posts: 7
Hi

I have a prob with displaying my combo box on the jsp properly.


my actionForm looks something like:
myActionForm{
myCustomDTOList
... other members
}

now this 'myCustomList' is in turn a java.util.List of my DTO objects.
how do I retrieve, say the name and id from the individual DTO's and populate the combo's labelProperty and property values with these ?

is this possible at all ?
some example syintax would be great ..

any help will be appreciated by this Struts newbie..

thanks in advance !
Deepa
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
In your JSP, use the <htmlptionsCollection> tag.

Here is a link that tells you how to use the tag.

You can use the <logic:iterate> tag to access the inner collection from within the outer collection - something like this:

<logic:iterate id="innerCollection" name="myForm" property="outerCollection" >
<htmlptionsCollection name="innerCollection" label="description" value="id" />
</logic:iterate>
[ March 08, 2006: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
 
GeeCON Prague 2014
 
subject: populating a select box from a collection within a collection in actionform