Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

How is fmt:formatNumber used?

Options
  • 03-09-2012 4:43pm
    #1
    Closed Accounts Posts: 6,075 ✭✭✭


    I am trying to format a percentage to 2 decimal places and the code I am using is not working.
    <form:input 
         class="calculator-percentage-input"
         value="<fmt:formatNumber value='${percentage}' maxFractionDigits='2'/>"
         path="discount" cssErrorClass="error"
    />
    

    The value displayed in my input box is (percentage is empty):
    <fmt:formatNumber value='' maxFractionDigits='2'/>
    
    Can anyone tell me how to just display the value of 'percentage'?


Comments

  • Closed Accounts Posts: 6,075 ✭✭✭IamtheWalrus


    Solution:

    <fmt:formatNumber var='myDiscountPercentage' value='${discountPercentage}' maxFractionDigits='2'/>

    <form:input
    class="calculator-percentage-input"
    value="${myDiscountPercentage}"
    path="discount" cssErrorClass="error"
    />


Advertisement