You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Laszlo Borsos (JIRA)" <ji...@apache.org> on 2007/12/28 15:41:33 UTC

[jira] Created: (WW-2396) displays double values with incorrect locale

<s:textfield> displays double values with incorrect locale
----------------------------------------------------------

                 Key: WW-2396
                 URL: https://issues.apache.org/struts/browse/WW-2396
             Project: Struts 2
          Issue Type: Bug
    Affects Versions: 2.0.11
         Environment: Java 6, Tomcat 6
            Reporter: Laszlo Borsos


I use the Hungarian locale, in which the decimal point is a comma. During page output the s:textfield tag displays double values incorrectly with a dot. However, when converting the submitted input value, it fails because it does not accept that dot, and expects (rightfully) the comma. Thus the unchanged html form cannot be resubmitted, making s:textfield unusable for doubles.

(Another issue, but) it is also a pity that s:textfield cannot use the custom formatting and parsing capabilities of MessageFormat just like s:text can format values using patterns stored in resource bundles.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2396) displays double values with incorrect locale

Posted by "Laszlo Borsos (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42861 ] 

Laszlo Borsos commented on WW-2396:
-----------------------------------

One possible solution:

In com.opensymphony.xwork2.util.XWorkBasicConverter.doConvertToString add this else clause:

else if (value instanceof Double || value instanceof Float) {
    NumberFormat nf = NumberFormat.getInstance(getLocale(context)); 
    result = nf.format(value);
}


> <s:textfield> displays double values with incorrect locale
> ----------------------------------------------------------
>
>                 Key: WW-2396
>                 URL: https://issues.apache.org/struts/browse/WW-2396
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.11
>         Environment: Java 6, Tomcat 6
>            Reporter: Laszlo Borsos
>
> I use the Hungarian locale, in which the decimal point is a comma. During page output the s:textfield tag displays double values incorrectly with a dot. However, when converting the submitted input value, it fails because it does not accept that dot, and expects (rightfully) the comma. Thus the unchanged html form cannot be resubmitted, making s:textfield unusable for doubles.
> (Another issue, but) it is also a pity that s:textfield cannot use the custom formatting and parsing capabilities of MessageFormat just like s:text can format values using patterns stored in resource bundles.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.