Struts2를 사용하고 있습니다. 내 pojo에 해시 세트가있다. 해시 셋에 값을 제출하려고합니다. 내 컬렉션 유형을 나열하도록 변경할 수있는 방법이 없습니다. 여기struts2의 해시 설정 값을 설정하십시오.
는 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;
}
}
액션
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/>
그래서이 나던 작품입니다. 위의 스 니펫을 사용하여 JSP를 제출할 때 오류가 발생하여 Item에서 personCollection을 채울 수 없습니다.
그래서 jsp의 명명 규칙은 무엇입니까? personCollection이 목록 일 경우처럼 item.personCollection[0].someProperty
을 사용할 수 있습니다. 그러나 집합 타입 집합의 이름을 어떻게 설정합니까?
무엇이 당신의 질문입니까? – mprabhat
자세한 설명이 필요합니다. –
가 – kunal