Hello,
I already wrote about it to users list, but I guess it belongs here.
I use version 1.2.4
Situation: I have a Form
public class SomeForm extends ValidatorForm {
private HashMap quantity = new HashMap();
public String getQuantity(String key) {
return (String) quantity.get(key);
}
public void setQuantity(String key, String val) {
this.quantity.put(key, val);
}
}
I write:
<html:text property="quantity(aaa)" />
<html:text property="quantity(bbb)" />
...
Works fine.
But in my situation, in the action where I just draw this form, in
request (as a leftover from previous request, after several forwards) I
recieve a value from a distant
<input type="text" name="quantity" />
So I get this:
java.lang.reflect.InvocationTargetException: Cannot set quantity
at
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1022)
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)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
<cut>
Caused by: java.lang.NoSuchMethodException: Property 'quantity' has no
setter method
at
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1782)
at
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684)
at
org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713)
at
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
... 44 more
Renaming quantity to qnty helped, so that they don't cross, but I think
that this exception is unnecessary and avoidable. I had to spend couple
of hours just to understand the cause...
Is it a bug? I didn't have too much time to search the bugzilla, but I
didn't see anything similar during a quick scan...
Thanks.
Pavel
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]