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 Mon, 14 Sep 2009 06:44:46 GMT
Hi
I just added my custom BigDecimal converter and it worked. I guess because I
took care of it.
But isn't it suppose to be taken care of by OGNL or Xwork? because if I
don't do it in a List, but as an direct Action property instead, there wont
be any warning message.

Thanks

On Mon, Sep 14, 2009 at 1:15 PM, dusty <dustin_pearce@yahoo.com> wrote:

>
> I saw similar errors when a Type Converter did not return a null when an
> empty value was given.  This could be an issue with the built-in conversion
> for Big Decimal.
>
> Can you try and override the Big Decimal converter with your own type
> converter and include code to return a null if the input value is blank?
>
>
>
> Steven Yang wrote:
> >
> > 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
> >> > >
> >> >
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Warning-message-when-setting-BigDecimal-to-list-of-bean-tp25359072p25430438.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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