This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes JSF and the fly likes JSF currencySymbol Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF currencySymbol " Watch "JSF currencySymbol " New topic
Author

JSF currencySymbol

Mathew Lee
Ranch Hand

Joined: Jun 08, 2009
Posts: 238
Hi,

I am trying to understand following code but could not understand.



<h:inputText id="sal" value="#{ManagedBean.sal}">
<f:convertNumber currencySymbol="$" type="currency"/>
</h:inputText><br>
<h:message for="sal" style="color:BLUE"/>
<hutputText value="#{ManagedBean.sal}">
<f:convertNumber currencySymbol="$" type="currency"/>
</hutputText>


Especially what currencySymbol is doing.

Please advise. Any links, ideas, suggestions, sample code, resources highly appreciated. Thanks in advance
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2956
    
  12

Well, you understand that currency means money, right? Money amounts are basically numbers, usually preceded (or succeeded) by currency symbols. So the numeric value in the managed bean will be converted to a string in HTML that has a dollar sign in front of it. That's all. Nothing too complicated going on there.

By the way, the current best practice is to use currencyCode instead of currencySymbol.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17151
    
  27

Also, when you declare a converter for currency, by default it uses whatever currency symbol is in effect for the locale. An explicit "currencySymbol" attribute overrides this.


An IDE is no substitute for an Intelligent Developer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSF currencySymbol
 
jQuery in Action, 3rd edition