Question

How to display positive value or absolute value of a number in jstl?

<fmt:formatNumber value="${-85}" format="%" /> <!-- should convert -85 to 85 -->
Was it helpful?

Solution

You can use el:

${value < 0 ? -value:value}

or Create a custom EL function which delegates to Math#abs(int).

OTHER TIPS

create you custom EL function in your code.

Try adding the type attribute to the expression.

<fmt:formatNumber type="currency" value="${-85}" />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top