Basically I have a custom tag that handles querying a java object for me.
<c:set var="profit">
<ct:get-profit transaction="${transaction}"/>
</c:set>
Now the problem is that I want to use that value (which is a float in an if statement, which I do as so:
<c:when test="${profit > 0}">
When I do that though I end up getting the following error.
javax.el.ELException: Cannot convert -141.75 of type class java.lang.String to class java.lang.Long
I have no idea how I can make this work. I was under the impression that JSTL’s would handle casting for you, is that incorrect? Either way, how would you go about making this work? Thanks
Can you try doing
0.00instead of0?<c:when test="${profit > 0.00}">.The reason you have to it is because 0 is getting treated as Long by the EL parser. However, “0.00” is getting treated as a float.