Hi,

I am trying to iterate through a vector to populate a select box.

I have a class CategoryList in application scope that holds a list of
Categories. Each category has a CategoryGroup name and a vector of
CategoryValues.

At run time I am trying to create a page that dynamically creates the above
select boxes not knowing how many elements will be in the list.

I can iterate through the CategoryGroupName via:

<logic:iterate id="category" name="CategoryList" property="categoryList"
scope="application">
  <bean:write name="category" property="categoryGroup" filter="true"/>

<!--need to figure out how to create select box -->

</logic:iterate>

Any help in figuring this out is appreciated.

My category class is as follows:

public class pwCategory
{

  private String categoryGroup;
  private String categoryName;
  private String categoryAbrv;
  private int categoryNumber;
  private String categoryValue;
  java.util.Vector categoryValues;

  public pwCategory()
  {
  }

  public String getCategoryGroup()
  {
    return categoryGroup;
  }

  public void setCategoryGroup(String newCategoryGroup)
  {
    categoryGroup = newCategoryGroup;
  }

  public void setCategoryAbrv(String newCategoryAbrv)
  {
    categoryAbrv = newCategoryAbrv;
  }

  public String getCategoryAbrv()
  {
    return categoryAbrv;
  }

  public void setCategoryNumber(int newCategoryNumber)
  {
    categoryNumber = newCategoryNumber;
  }

  public int getCategoryNumber()
  {
    return categoryNumber;
  }

  public void setCategoryValue(String newCategoryValues)
  {
    categoryValue = newCategoryValues;
  }

  public String getCategoryValue()
  {
    return categoryValue;
  }

  public void setCategoryValues(java.util.Vector newCategoryValues)
  {
    categoryValues = newCategoryValues;
  }

  public java.util.Vector getCategoryValues()
  {
    return categoryValues;
  }
}

My categoryList class is as follows:


import java.util.*;
import com.popware.avantis.*;

public class pwCategoryList
{
  private List categoryList=new Vector();

  public pwCategoryList()
  {
  }

  public List getCategoryList()
  {
    return categoryList;
  }

  public void setCategoryList(List categoryList)
  {
    this.categoryList = categoryList;
  }

  public void addCategoryList(pwCategory newCategory)
  {
    categoryList.add(newCategory);
  }
}

Regards

Alex

Reply via email to