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

nested logic:iterate and Struts submit

 
joe priv
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am using Spring, Hibernate and Struts to collect a hierarchy (ArrayList) of data from a view (.jsp). I can **display** the parent and nested children in the hierarchy using either nested logic:iterate or nested:iterate tags from the view without a problem.

I got this working fine for a single level of children using index properties http://faq.javaranch.com/java/IndexedProperties

My question is around multiple nested iterates and submitting the form. I am unable to get this to work. Does anyone have any direct experience with this? If so can you point me towards a working example.

Example
logic:iterate
logic:iterate
collect user input here and have it post back to the the javabean
model.

When I debig my Action I never see the second level children collection being populated. The html form looks like this:

parent.children1[0].children2[0].property
parent.children1[0].children2[1].property
parent.children1[1].children2[0].property
parent.children1[1].children2[1].property
parent.children1[1].children2[2].property
etc

I was thinking that Struts (BeanUtils) will populate the ActionForm on a submit, but it just isn't doing anything.

Thanks and any help!

-JP
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have indexed getters for each level? Not only the ActionForm bean, but each JavaBean in the tree must have indexed getters. Example:

 
joe priv
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks! That makes sense. I will try this.
 
joe priv
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That worked! Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic