Monday 30 January 2012

JSF: outputText doesn't not localize a Double-value

I want to localize the Double attribute value of the managed bean fooBean in Greek; i.e. number 12.3 should be 12,3 in greek locale (locale=el) and 12.3 in english locale (locale=en) Wrong code:
 <h:outputText value="#{fooBean.value}" />
Right code:
 <h:outputText value="#{fooBean.value">
    <f:convertNumber type="number" />
</h:outputText>

2 comments:

  1. Can you repost the right and wrong code please?

    btw I found your blog while searching for a solution for greek data entered in input text fields, when I display them in a e.g. datatable they come out like χαιρετω while the labels etc don't have any problem with the greek.
    Any ideas?
    thanks

    ReplyDelete
  2. Hi MarJSF. As far as I can figure out the encoding in your pages is ok since the labels work fine. The problem is probably in the db; either on storing the data or retrieving them..read this post http://micharg.blogspot.com/2011/04/enable-utf8-for-all-future-tables-in.html for the right way to save utf-8 data in the db (mysql).

    ReplyDelete