user3069474
user3069474

Reputation:

How do I format a Currency value using jstl format tag?

I have a text box, The value in that text box like 0.0 it is the currency value i need to format it the code is like below

 - <div class="input"> <input type="radio" name="minSavingsPre"
   id="minSavingsOn" class="_mirror
   {mirror:{to:'minPlaceholder',autoSubmit:false}}" value="true" />
   <buxwatch:message
   code="fi.admindashboard.rewardcontrols.savingsthresholds.mindollarsavingsofeachreward.radio"
   /> <input type="text" name="minimumSavingPre" id="minimumSavingPre"
   class="_mirror {rules:{required:function(element) {return
   $('#minPlaceholder').val() ==
   'true';}},mirror:{to:'minimumSaving',autoSubmit:false}}" /> </div>

I dont know exactly how to format it by using JSTL Can any one help me

Upvotes: 6

Views: 11123

Answers (1)

Jigar Joshi
Jigar Joshi

Reputation: 240928

You could use JSTL tag <fmt:formatNumber> for this purpose

for example:

<p>Currency in USA :
<fmt:setLocale value="en_US"/>
<fmt:formatNumber value="${balance}" type="currency"/></p>

output: (with balance = 120000.23)

Currency in USA : $120,000.23

See

Upvotes: 9

Related Questions