• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSF currencySymbol

 
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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"/>
<h:outputText value="#{ManagedBean.sal}">
<f:convertNumber currencySymbol="$" type="currency"/>
</h:outputText>


Especially what currencySymbol is doing.

Please advise. Any links, ideas, suggestions, sample code, resources highly appreciated. Thanks in advance
 
Sheriff
Posts: 3063
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Saloon Keeper
Posts: 27807
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic