File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
sushilkumar jamesbond
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic