Solved

JSF currencySymbol

Posted on 2011-03-08
2
433 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
Comment Utility
<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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now