[
https://issues.apache.org/jira/browse/WICKET-1254?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12557490#action_12557490
]
Eduardo Issao Ito commented on WICKET-1254:
-------------------------------------------
Yes, it is easy to create a BigDecimalConverter, but as it is a type provided
by Java itself, it makes sense to include such a converter in core Wicket... We
should apply the "Principle of Least Surprise"!
I used the converter below and it worked fine:
class BigDecimalConverter extends AbstractDecimalConverter {
protected Class getTargetType() {
return BigDecimal.class;
}
public Object convertToObject(String value, Locale locale) {
if (value == null || value.trim().equals(""))
return null;
NumberFormat format = getNumberFormat(locale);
try {
return format.parse(value);
} catch (Exception e) {
throw newConversionException("Cannot parse '" + value + "'
using format " + format,
value, locale).setFormat(format);
}
}
}
> Binding to a BigDecimal don't honor browser locale
> --------------------------------------------------
>
> Key: WICKET-1254
> URL: https://issues.apache.org/jira/browse/WICKET-1254
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.3.0-rc2
> Environment: Windows XP, Firefox 2.0.0.11, tomcat-5.5.25, Java
> 1.6.0_03
> Reporter: Eduardo Issao Ito
>
> Binding from a TextField to a BigDecimal property does not honor the Locale
> used by the browser.
> With the pt_BR locale configured in Firefox, binding "0,25" to a Double works
> as expected giving 0.25 value, but to a BigDecimal it gives the error "'0,25'
> não é um BigDecimal válido."
> It is a major problem with localized applications.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.