You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by RAMYA BALA CHIVUKULA Padmanabha <PR...@covansys.com> on 2003/12/23 07:08:59 UTC

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: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org