the date string into a Date object. You can either populate the form
with the formatted date or register a Converter to handle the conversion appropriately. I haven't yet used Converter but this problem
has been answer many times over on the list.
This link may help: http://www.mail-archive.com/struts-user@jakarta.apache.org/msg45982.html
/robert
Robin Ericsson wrote:
Hi,
This is my form: <form-bean name="daysForm" type="org.apache.struts.action.DynaActionForm"> <form-property name="days" type="mypackage.MyClass[]"/> </form-bean>
This is how I populate it: List days = new ArrayList(); --fill list-- form.set("days", (MyClass[]) days.toArray(new MyClass[days.size()]));
This is my jsp-code: <html:form action="/days-submit"> <logic:iterate id="days" name="daysForm" property="days"> <bean:write format="dd/M" name="days" property="day" /> <html:text name="days" property="entered" indexed="true" /> <br /> </logic:iterate> <html:submit accesskey="s" value="Save... (Alt+s)" /> </html:form>
The generated html seems correct as it finds the actual data in the MyClass property.
<input type="text" name="days[0].startTime" value="08:00:00" />
However, when I post the form, I get an IllegalArgumentException:
java.lang.IllegalArgumentException: argument type mismatch
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:324)
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684)
org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713)
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493)
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:796)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1192)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:430)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)
startTime is of type java.util.Date with respective getter and setter.
Any ideas what I've done wrong?
regards, Robin
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]