On Apr 8, 2005 8:58 AM, Pavel Jbanov <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I already wrote about it to users list, but I guess it belongs here.
No, actually it belongs on the user list.
> 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
When you say "after several forwards", do you mean you are chaining
actions? That is, forwarding from one action to another? If so, the
problem you are seeing is an inevitable consequence of that, which is
why chaining actions is strongly discouraged.
Instead of chaining Actions, you should be delegating from your (one)
Action to your business logic. One option, if you really need a chain,
is to use the ChainAction class from the Struts Chain package (in
contrib), and implement each of the pieces of the chain as a Command.
--
Martin Cooper
> 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]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]