Hello,

(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);
    }
        
    public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
            //...
    }
}

I write:
<html:text property="quantity(1)" />
<html:text property="quantity(2)" />
...

Works fine.

But in my situation, in the action/jsp where I just draw this form, in
request (as a leftover from previous request, after several forwards) I
recieve a value from a distant
<html:text property="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, but I think that this exception is
unnecessary and avoidable.

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]

Reply via email to