wood burning stoves 2.0*
The moose likes Struts and the fly likes nested logic:iterate and Struts submit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "nested logic:iterate and Struts submit " Watch "nested logic:iterate and Struts submit " New topic
Author

nested logic:iterate and Struts submit

joe priv
Greenhorn

Joined: Oct 06, 2007
Posts: 9
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

Joined: Feb 15, 2005
Posts: 4864
Do you have indexed getters for each level? Not only the ActionForm bean, but each JavaBean in the tree must have indexed getters. Example:



Merrill
Consultant, Sima Solutions
joe priv
Greenhorn

Joined: Oct 06, 2007
Posts: 9
Thanks! That makes sense. I will try this.
joe priv
Greenhorn

Joined: Oct 06, 2007
Posts: 9
That worked! Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: nested logic:iterate and Struts submit
 
Similar Threads
forbean's getmethod never called
html:text inside logic:iterate
struts2: how to create dynamic input field?
logic:iterate not populating the values on submit
display items from DB, update and save ??