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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

JSP <fmt:formatNumber> problem

  • 28-01-2004 4:47pm
    #1
    Registered Users, Registered Users 2 Posts: 4,225 ✭✭✭


    when doing the following operation

    <fmt:formatNumber var="totalin" value="${totalrow.Received}" />
    <fmt:formatNumber var="totalout" value="${totalrow.Sent}" />
    <fmt:formatNumber var="total" value="${totalin + totalout}" />

    i'm getting this error

    An error occurred while evaluating custom action attribute "value" with value "${totalin + totalout}": An exception occured trying to convert String "1,114" to type "java.lang.Long"

    where 1114 is the value returned to either totalin or totalout.

    its very weird. this error only crops up when one of the values to be added is > 999

    ??


Comments

  • Registered Users, Registered Users 2 Posts: 68,317 ✭✭✭✭seamus


    You're attempting to add two formatted strings together. numberFormat I'm guessing adds in commas for the thousands.

    When it's a value under 1000, it autmatically casts them to long and adds them together. But if it's > 999 then, it formats it to x,xxx and then tries to cast to long, which it can't, since a comma isn't a number. :)

    replace "${totalin + totalout}"
    with "${totalrow.Received + totalrow.Sent}"


Advertisement