Frankie, here it works also with "0.0" entered in the UI. Cimballi
On Wed, Feb 10, 2010 at 11:32 AM, BlackKnight <wwwwar3...@gmail.com> wrote: > Hi Cimballi, > > > Have you tried to set latitude = 0f (in java class) or 0.0 in the web > textfield and then submit the form? > > I debuged the source code and I believe there is a bug in ongl when > handling float value 0, > > Of course when the value is not 0f, ognl can handle converition from string > to float quite well. > > > Frankie > > > Cimballi 写道: >> >> I have a working case with this declaration : >> private Float latitude; and getXxx setXxx. >> >> And in the JSP : <s:textfield key="latitude" /> >> >> Using Struts 2.1.8.1 >> >> Cimballi >> >> >> 2010/2/9 BlackKnight <wwwwar3...@gmail.com>: >> >>> >>> Hi, >>> >>> Just curious, >>> >>> Lib Version: >>> ognl 2.6.11/Struts2.1.6, >>> >>> Initial setting: >>> I have a float variable utm1 in my java model class, the initial value >>> is set to to 0f, >>> >>> Problem Desc: >>> when submitting the form, struts2 throw a error something like "can't >>> find the setter methods SetUtm1(String)". >>> >>> Debug and trace info: >>> After the submitting, struts2 call ognl to set value of utm1, first ognl >>> look up for a converter to convert the para type(String) to the java >>> class type(Java.lang. float). However, there isn't any converter handle >>> such kind of convertion. So the ognl try to treat the para as a string >>> and apply the SetUtm1(String) methods. >>> >>> Question: >>> Is it true that ognl didn't handle convertion from string to float? How >>> do you guys handle float variable in struts2 form? >>> >>> Any comments? Thanks >>> >>> >>> Frank >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >>> For additional commands, e-mail: user-h...@struts.apache.org >>> >>> >>> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org