struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Yang <kenshin...@gmail.com>
Subject Re: Warning message when setting BigDecimal to list of bean
Date Sun, 13 Sep 2009 03:25:55 GMT
so...this is an OGNL error? is there a way to fix it? or should i file a
bug?

On Fri, Sep 11, 2009 at 12:32 AM, j alex <strutstwouser@gmail.com> wrote:

> hmm..i remember getting the warning even for doubles..as the error message
> says, OGNL fails when trying to set a String array (all request parameters
> are Strings ) into the BigDecimal field since it cannot find an appropriate
> setter.
>
> In connection to this, can anyone let me know how to suppress this message
> with lo4j.properties (not log4j.xml) configuration.
>
> On Thu, Sep 10, 2009 at 11:59 AM, Steven Yang <kenshin520@gmail.com>
> wrote:
>
> > Sorry I forgot to mention
> > I am using Struts 2.1.8 SNAP SHOT with XWork 2.1.6
> > samething happens with XWork 2.1.5
> >
> > On Wed, Sep 9, 2009 at 2:03 PM, Steven Yang <kenshin520@gmail.com>
> wrote:
> >
> > > 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