struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From BlackKnight <wwwwar3...@gmail.com>
Subject Re: ognl can't handle converting from string to float?
Date Thu, 11 Feb 2010 14:45:24 GMT
Hi, Cimballi,

       I find it out, it's a bug of xwork 2.1.2, not ognl~~.
  
       The converstion failed in xwork2,

       Acctually , xwork guys has already noticed this and have  it 
fixed since xwork2.1.3.

       Xwork2.1.3. Changlong : 
http://jira.opensymphony.com/secure/ReleaseNote.jspa?projectId=10050&styleName=Html&version=21790

<http://jira.opensymphony.com/secure/ReleaseNote.jspa?projectId=10050&styleName=Html&version=21790>

            [XW-677 <http://jira.opensymphony.com/browse/XW-677>] - 
double/float parameters not converted when <= 0
 
     Struts2.1.8 is using xwork 2.1.6 so it didn't have this problem in 
dealing with 0.0:-)
 
  
 
Frankie

Cimballi 写道:
> Frankie, here it works also with "0.0" entered in the UI.
>
> Cimballi
>
>
> On Wed, Feb 10, 2010 at 11:32 AM, BlackKnight <wwwwar3com@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 <wwwwar3com@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-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>>
>>>>         
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>   


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


Mime
View raw message