异常流水-javax.el.ELException-类型转换异常

javax.el.ELException: Cannot convert 1,0 of type class java.lang.String to class java.lang.Long

jsp的EL表达式中,若用String类型的对象与数值做eq等计算时,会先将String对象转为double类型。所以当String对象含有非数字字符时会出现此异常。

<c:if test="${product.type eq 30}">
//安全写法
<c:if test="${product.type eq '30'}">

猜你喜欢

转载自tjy86.iteye.com/blog/2366204
今日推荐