Sorry
Sorry

Reputation: 1

JSTL cannot parse a double variable multiplied by an integer variable?

If I set two variables in my controller:

double doubleAmount = 18.0;
int integerAmount = 2;

And then try to multiply them in my JSTL code:

<c:set var="result" value="${doubleAmount} * ${integerAmount}"/>

I get this error:

javax.servlet.ServletException: 
javax.servlet.jsp.JspException: 
In &lt;formatNumber&gt;, 
value attribute can not be parsed into java.lang.Number: 
"18.0 * 2"

How do I perform this operation in my JSTL code?

Upvotes: 0

Views: 7827

Answers (1)

Yasin Bahtiyar
Yasin Bahtiyar

Reputation: 2367

Try <c:set var="result" value="${doubleAmount * integerAmount}"/> please.

Upvotes: 4

Related Questions