Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

How is fmt:formatNumber used?

  • 03-09-2012 03: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