struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Yang <kenshin...@gmail.com>
Subject Warning message when setting BigDecimal to list of bean
Date Wed, 09 Sep 2009 06:03:16 GMT
Hi
I have a bean like
public class Account {

    private String type;
    private String name;
    private BigDecimal value1;
    private BigDecimal value2;
    private BigDecimal value3;
//getter, setters
}

in my action i have

public class TestAction extends ActionSupport {

    private List<Account> accounts = new ArrayList<Account>();
//getter, setters, execute
}

in my JSP:

<tr>
    <td><input type="text" name="accounts[0].name"/></td>
    <td><input type="text" name="accounts[0].value1"/></td>
    <td><input type="text" name="accounts[0].value2"/></td>
    <td><input type="text" name="accounts[0].value3"/></td>
    <td>%</td>
</tr>
<tr>
    <td><input type="text" name="accounts[1].name"/></td>
    <td><input type="text" name="accounts[1].value1"/></td>
    <td><input type="text" name="accounts[1].value2"/></td>
    <td><input type="text" name="accounts[1].value3"/></td>
    <td>%</td>
</tr>

When i submit the form, i get warning message like the following when the
BigDecimal value fields are empty :

2009-09-09 13:52:44,156 [http-80-Processor125] WARN
 com.opensymphony.xwork2.ognl.OgnlValueStack  - Error setting expression
'accounts[0].value2' with value '[Ljava.lang.String;@165de14'
ognl.MethodFailedException: Method "setValue2" failed for object
junit.adm.authority.Account@7a8ba4 [java.lang.NoSuchMethodException:
junit.adm.authority.Account.setValue2([Ljava.lang.String;)]
at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1265)
at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:1454)
at
ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:85)
at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:162)
at
com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:28)
at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2225)...

If the fields have value, then there is no message for that particular field
and value gets set properly. Only occur if the field is empty.
If i change the property in Account to Double or double, there wont be any
warning.

I am not running under devMode = true.

Is this a bug? or something else?
Thanks

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message