Solved

JSF currencySymbol

Posted on 2011-03-08
2
438 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to install java on RHEL image on EC2 4 51
servlet and mdb, jms error 1 54
passing enum to a method 4 34
Html split(text) 2 26
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
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…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

679 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