Solved

JSF currencySymbol

Posted on 2011-03-08
2
443 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
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.
Suggested Courses

630 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