There is another way..I think struts has a lazy list implementation which takes of thsi problem...
Or see this post..This is reply to a similar question that was asked on the list earlier...And this is a lot cleaner implementation... http://marc.theaimsgroup.com/?l=struts-user&m=106543028416768&w=2 If still in doubt , ask again.I will try to help you out... HTH. regards, Shirish. -----Original Message----- From: Shishir K. Singh [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 23, 2003 8:50 AM To: Struts Users Mailing List Subject: RE: Nested Problem. Why don't you design your bean like this: If it's a one time set of the collection,then public class NestedParentBean extends ActionFormBase{ private String parentName = null; private String parentId = null; private java.util.ArrayList childBeanCollection = null; public String getParentName() { return parentName; } public void setParentName(String parentName) { this.parentName = parentName; } public String getParentId() { return parentId; } public void setParentId(String parentId) { this.parentId = parentId; } public java.util.ArrayList getChildBeanCollection() { return childBeanCollection; } public void setChildBeanCollection(java.util.ArrayList childBeanCollection) { if (childBeanCollection != null && childBeanCollection.size() > 0) { if ( this.childBeanCollection == null) { this.childBeanCollection = new ArrayList(childBeanCollection.size()); } for (int i = 0; i < childBeanCollection.size(); i++ ) { this.childBeanCollection.add(childBeanCollection.get(i)); } } } } Else just set the this.childBeanCollection = null before allocating memory in setChildBeanCollection -----Original Message----- From: RAMYA BALA CHIVUKULA Padmanabha [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 23, 2003 1:09 AM To: Struts-User (E-mail) Subject: Nested Problem. Hi , Can any one solve this problem for me. I have a Parent Bean of the Structure. public class NestedParentBean extends ActionFormBase{ private String parentName; private String parentId; private java.util.ArrayList childBeanCollection; public NestedParentBean() { for(int i=0;i<20;i++){ NestedChildBean nesChldBean = new NestedChildBean(); childBeanCollection.add(nesChldBean); } } public String getParentName() { return parentName; } public void setParentName(String parentName) { this.parentName = parentName; } public String getParentId() { return parentId; } public void setParentId(String parentId) { this.parentId = parentId; } public java.util.ArrayList getChildBeanCollection() { return childBeanCollection; } public void setChildBeanCollection(java.util.ArrayList childBeanCollection) { this.childBeanCollection = childBeanCollection; And Child Bean of the Structure public class NestedChildBean extends ActionFormBase{ private String childId; private String childName; public NestedChildBean() { } public String getChildId() { return childId; } public void setChildId(String childId) { this.childId = childId; } public String getChildName() { return childName; } public void setChildName(String childName) { this.childName = childName; } The problem for me now is .. I do not know the number of childBeans that would be available and I do not want to hardcode as shown above, I'm able to display in the Jsp.. ActionFormBase refers to one of our baseclasses Can anyone help me out with how to create dynamic reference for the childBean? Regards, Ramya --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]