Solved

JSF currencySymbol

Posted on 2011-03-08
2
437 Views
Last Modified: 2012-05-11
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
0
Comment
Question by:gudii9
2 Comments
 
LVL 20

Accepted Solution

by:
a_b earned 500 total points
ID: 35070944
<h:inputText id="sal" value="#{ManagedBean.sal}">
Here the code is expecting an input that is bound to the setSal method in the ManagedBean

<f:convertNumber currencySymbol="$" type="currency"/>
This is an in built currency convertor; that does the conversion for the values you enter in the input text.

Here is a link that shows how it works  -

http://spring-app.blogspot.com/2010/01/jsf-using-currency-symbol.html
0
 
LVL 7

Author Comment

by:gudii9
ID: 35071664
why we need to use 'currencySymbol' in inputText. It made sense in outputText. Does that mean we can conver from say Rp to Dollar etc if i give like

<h:inputText id="sal" value="#{ManagedBean.sal}">
<f:convertNumber currencySymbol="Rp" type="currency"/>
</h:inputText><br>
<h:message for="sal" style="color:BLUE"/>
<h:outputText value="#{ManagedBean.sal}">
<f:convertNumber currencySymbol="$" type="currency"/>
</h:outputText>
So input text accept currency as Rp and output tect converts that to $ and displays?

Please advise
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
object oriented programming comparison 5 77
designing in object programming 12 94
jboss wildfly 10.1 10 232
CSV file parsing thru Java 13 34
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question