开发者

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

开发者 https://www.devze.com 2023-03-03 12:51 出处:网络
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:

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.Serv开发者_开发技巧letException: 
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.

0

精彩评论

暂无评论...
验证码 换一张
取 消