简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM