You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Bill Bohnenberger <bi...@gmail.com> on 2009/10/03 01:43:47 UTC

ognl problem with double value in form

I have a double in an action:

    private double dval;

with mutators

    public double getDval() { return dval; }

    public void setDval (double dval) { this.dval = dval; }

I have this form in my jsp page:

<s:form action="TestAction_doCommand">
    <s:textfield label="Double Value" name="dval" size="10"/>
    <s:submit/>
</s:form>

Whenever I enter "0" or "0.0" in the text field, OGNL throws

ognl.MethodFailedException: Method "setDval" failed for object
com.rp.db.actions.TestAction@16cefa8 [java.lang.NoSuchMethodException:
setDval([Ljava.lang.String;)]

BUT, it properly converts all non-zero values without complaint and even
converts the empty string to "0.0"!

Is there some way I can get OGNL to accept the "0" and "0.0" values?

Thanks,
Bill B

Re: ognl problem with double value in form

Posted by Bill Bohnenberger <bi...@gmail.com>.
OK, thanks, Wes. Sorry I forgot to mention I was using 2.1.6.

Works fine with 2.1.8 jars!

Thanks again,
- Bill

On Sat, Oct 3, 2009 at 9:57 AM, Wes Wannemacher <we...@wantii.com> wrote:

> Which version of struts are you using? We updated the OGNL dependency
> between 2.1.6 & 2.1.8, so if this is a bug with the new version we'll
> have to address it. If it's a problem with an old version, try
> updating to 2.1.8 jars.
>
> -Wes
>
> On Fri, Oct 2, 2009 at 7:43 PM, Bill Bohnenberger <bi...@gmail.com>
> wrote:
> > I have a double in an action:
> >
> >    private double dval;
> >
> > with mutators
> >
> >    public double getDval() { return dval; }
> >
> >    public void setDval (double dval) { this.dval = dval; }
> >
> > I have this form in my jsp page:
> >
> > <s:form action="TestAction_doCommand">
> >    <s:textfield label="Double Value" name="dval" size="10"/>
> >    <s:submit/>
> > </s:form>
> >
> > Whenever I enter "0" or "0.0" in the text field, OGNL throws
> >
> > ognl.MethodFailedException: Method "setDval" failed for object
> > com.rp.db.actions.TestAction@16cefa8 [java.lang.NoSuchMethodException:
> > setDval([Ljava.lang.String;)]
> >
> > BUT, it properly converts all non-zero values without complaint and even
> > converts the empty string to "0.0"!
> >
> > Is there some way I can get OGNL to accept the "0" and "0.0" values?
> >
> > Thanks,
> > Bill B
> >
>
>
>
> --
> Wes Wannemacher
>
> Head Engineer, WanTii, Inc.
> Need Training? Struts, Spring, Maven, Tomcat...
> Ask me for a quote!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: ognl problem with double value in form

Posted by Wes Wannemacher <we...@wantii.com>.
Which version of struts are you using? We updated the OGNL dependency
between 2.1.6 & 2.1.8, so if this is a bug with the new version we'll
have to address it. If it's a problem with an old version, try
updating to 2.1.8 jars.

-Wes

On Fri, Oct 2, 2009 at 7:43 PM, Bill Bohnenberger <bi...@gmail.com> wrote:
> I have a double in an action:
>
>    private double dval;
>
> with mutators
>
>    public double getDval() { return dval; }
>
>    public void setDval (double dval) { this.dval = dval; }
>
> I have this form in my jsp page:
>
> <s:form action="TestAction_doCommand">
>    <s:textfield label="Double Value" name="dval" size="10"/>
>    <s:submit/>
> </s:form>
>
> Whenever I enter "0" or "0.0" in the text field, OGNL throws
>
> ognl.MethodFailedException: Method "setDval" failed for object
> com.rp.db.actions.TestAction@16cefa8 [java.lang.NoSuchMethodException:
> setDval([Ljava.lang.String;)]
>
> BUT, it properly converts all non-zero values without complaint and even
> converts the empty string to "0.0"!
>
> Is there some way I can get OGNL to accept the "0" and "0.0" values?
>
> Thanks,
> Bill B
>



-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org