Hi,
I am new to this mailing list (i.e. I am sorry if I do something wrong,
please don't flame me). I am not new to struts but I am new to the more
advanced tags. I have run into this problem. I think that I am close but
just not understanding a key concept.
I am trying to create an HTML form like so:
Item1Label Item1Textbox
Item2Label Item2Textbox
Item3Label Item3Textbox
What is new to me is the fact that in this case, the number of items vary
and the item labels vary.
I can display the page fine with the populated values for edit but when I
try to do a save, I get the following struts exception:
javax.servlet.ServletException:BeanUtils.populate at
org.apache.struts.util.RequestUtils.populate RequestUtils.java:1254) at
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j
ava:821) at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
It seems to be having trouble activating my setter in my form but not sure
why. I think because I have setup something improperly but don't know what.
I have done some research on the Internet and by following by example I have
developed the following:
<html:form action="MainFormSave.do">
<nested:iterate property="itemList">
<nested:hidden property="itemName" />
<nested:write property="itemName" />
<nested:text property="itemDescription" />
</nested:iterate>
</html:form>
I have a MainForm class which includes the following:
private ArrayList _itemList = new ArrayList();
public void setItemList(int index, ItemBean item) {
if (index < this._itemList.size()) {
this._itemList.set(index, item);
} else {
this._itemList.add(item);
}
}
public ArrayList getItemList() {
return (this._itemList) ;
}
And I have an ItemBean which includes the following:
private String _itemName = null;
private String _itemDescription = null;
public void setItemName(String name) {
this._itemName=name;
}
public String getItemName() {
return (this._itemName) ;
}
public void setItemDescription(String desc) {
this._itemDescription=desc;
}
public String getItemDescription() {
return (this._itemDescription) ;
}
Thanks in advance,
Katie Wright (who is hoping that it is not something completely obvious)
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]