我有以下行动表格:
public class ImageGalleryActionForm extends org.apache.struts.action.ActionForm {
private String name;
private List<GalleryImage> images;
//GalleryImage is just a class with name and description as strings (and get/set methods)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<GalleryImage> getImages() {
return images;
}
public void setImages(List<GalleryImage> images) {
this.images = images;
}
public ImageGalleryActionForm() {
this.name = "";
this.images = new ArrayList<GalleryImage>();
}
@Override
public void reset(ActionMapping mapping,HttpServletRequest request){
name = "";
images = new ArrayList<GalleryImage>();
}
}
在一个Action i中预加载 images 列表的一些值,在JSP中我显示这些值,并允许用户更改图像的描述和图库的名称: / p>
<html:form action="/pages/createNewGalleryAction" method="
Gallery name: <html:text property="name" />
<logic:iterate id="images" name="ImageGalleryActionForm" property="images">
Image name: <bean:write name="images" property="name"/>
Description:<br/>
<html:textarea name="images" property="description" />
</logic:iterate>
<html:submit>Submit</html:submit>
</html:form>
这显示了预期,但当下一个操作收到表单时,它只正确设置了ImageGalleryActionForm 名称。列表 images 只是空的。
错误在哪里?