And use this to get a converter with l10n:

  | 
  | import java.math.BigDecimal;
  | 
  | import javax.faces.component.UIComponent;
  | import javax.faces.context.FacesContext;
  | import javax.faces.convert.NumberConverter;
  | 
  | /**
  |  * Converts a Double or Long value provided by standard jsf number 
  |  * converter to a BigDecimal value
  |  * 
  |  * To get a locale-sensitive converter, java.text.NumberFormat is used
  |  * (through javax.faces.convert.NumberConverter). 
  |  * The parsing done by java.math.BigDecimal is not affected by locale.
  |  * See javax.faces.convert.BigDecimalConverter
  |  * 
  |  */
  | public class BigDecimalConverter extends NumberConverter 
  | {
  | 
  |     /*
  |      *  don't use BigDecimal ctor
  |      *  see java.math.BigDecimal
  |      */
  |     public Object getAsObject(FacesContext context, UIComponent component, 
String string) {
  |         Object value = super.getAsObject(context, component, string); 
  |         if (value instanceof Long) return BigDecimal.valueOf((Long) value);
  |         if (value instanceof Double) return BigDecimal.valueOf((Double) 
value);
  |         return value;
  |     }
  | }
  | 
  | 
  | 
  | 
  | 

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4080078#4080078

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4080078
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to