Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Indexed property on a form in request scope.

Status
Not open for further replies.

alpot

Programmer
Mar 8, 2001
8
US
I have a DynaValidatorActionForm with the following property

<form-bean name="frm" type="MyForm">
<form-property name="children" type="java.util.ArrayList" />
</form-bean>


The JSP looks like this..

<logic:iterate name="frm" id="child" property="children" indexId="index" >
<tr>
<td>
<html:text name="frm" property='<%= "children[" + index +"]" %>' />
</td>
</tr>
</logic:iterate>


I have an Add Row which does the following in the Action


public ActionForward add(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {

DynaValidatorActionForm dynaForm = (DynaValidatorActionForm) form;
ArrayList l = (ArrayList) dynaForm.get("children");
l.add("new child " + l.size());
dynaForm.set("children", l);
return mapping.findForward("success");
}



The above works fine, as long as my form is defined to be
in session scope. It gives me a

java.lang.IllegalArgumentException: No bean specified
at org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(PropertyUtils.java:837)
at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:934)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)
at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:205)


when I define the bean in request scope
 
In the above post...

<form-bean name="frm" type="org.apache.struts.validator.DynaValidatorActionForm">
<form-property name="children" type="java.util.ArrayList" />
</form-bean>


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top