I am using Struts2. I have a hashset in my pojo. I am trying to submit values to the hashset. There is no way i can change my collection type to list.
here is pojo
Item{
Set<Person> personCollection;
long itemCode;
public void setItemCode(long itemCode)
{
this.itemCode=itemCode;
}
public long getitemCode()
{
return itemCode;
}
public void setPersonCollection(Set<Person>personCollection)
{
this.personCollection=personCollection;
}
public Set<Person> getPersonCollection()
{
return personCollection;
}
}
Person{
String name;
public void setName(String name)
{
this.name=name;
}
public String getName()
{
return name;
}
}
Action
SubmitItemAction
{
private Item item;
public getItem()
{
return item;
}
public setItem(Item item)
{
this.item=item;
}
public String submitItem()
{
dao.submit(item);
}
}
jsp
<s:text name=item.personCollection[0].name/>
<s:text name=item.personCollection[1].name/>
so this doesnt work. When i submit my jsp with above snippet it gives error, its not able to populate personCollection from Item.
So what should be naming convention in jsp. Like if personCollection would have been a list I could have used item.personCollection[0].someProperty
. But how do you set the name for collection of type set.