-1
我想迭代ArrayList元素并更新列表元素,然后保存它。Struts 1.2 - 显示和更新ArrayList项目
My Form Bean:
MyTestCodeForm.java - it have two members id and ArrayList.
String id;
ArrayList<Book> listBook;
getter和setter id属性的 getter和ArrayList中的
public void setListBook(ArrayList<Book> bookList)
{
this.listBook = bookList;
}
public ArrayList<Book> getListBook()
{
return this.listBook;
}
Book.java have two members
String bookId;
String bookName;
Action class - MyTestCodeAction.java
制定者在这方面,我有获取数据并保存到数据库中。对于迭代
我的jsp页面:
<nested:nest property='myTestCodeForm'>
<html:form action='/myTestCodeForm'>
<nested:write name='' property='id'/>
<html:hidden name='' property='id'/>
<nested:iterate id='foo' name='' property='bookList'>
<html:text name='foo' property='bookName' indexd='true'/>
</nested:iterate>
<html:submit value='submit'/>
</html:form>
</nested:nest>
我的问题是,我成功地重复数据,但是当我得到的数据转化为动作类我没有收到数组列表数据,但我收到的id属性。
请帮忙
Abhijeet,你能告诉我目标类的代码,其中bean值将被设置,还有struts-config.xml,我想你不是正确配置模型属性。 –
感谢您的回复,但我得到了我的解决方案。见解决方案。 –