Reputation: 17697
This works :
<h:outputText value="Active Locale : " />
#{view.locale}
But how can i achieve something like this with EL ?
<h:outputText value="Active Locale Decimal Separator : " />
#{new DecimalFormat(view.locale).decimalFormatSymbols.groupingSeparator}
Upvotes: 2
Views: 1302
Reputation: 38163
I wonder what you exactly mean with groupingSeparator
?
The standard java.text.DecimalFormat
has neither a getGroupingSeparator
nor groupingSeparator
field or method. So I'm a bit in the dark what you're actually trying to achieve. Would you like to have the _ printed? So if the local is en_uk, that the result is "_"?
Regardless of what you exactly want, you can pretty much do everything by building your own EL functon. In EL it would then look like this:
#{my:someFormatting(view.locale)}
someFormatting is then implemented as a static Java method, which you then assign your own namespace ("my" in this case). Look up a tutorial to help you with this if you need that.
There are also a few standard EL functions available to Facelets. These are the JSTL functions defined in the following namespace:
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
Depending on what you exactly need they may be of some help as well.
Upvotes: 4