我在JSP中有如下代码
<td class=odd
style="text-align: center"
height=30><c:if
test="${mMap['GENERAL'].errorFac != 0 and not empty mMap['GENERAL'].errorFac}">
<c:choose>
<c:when test="${mMap['GENERAL'].errorFlag == true}">
<A style="font-size:9pt" href="javascript:openWindow('${m.eTax}','${m.eDate}','GENERAL')" >
<fmt:formatNumber
value="${mMap['GENERAL'].errorFac}"
type="number" pattern="#,##0.0000" /></A>
</c:when>
<c:otherwise>
<fmt:formatNumber
value="${mMap['GENERAL'].errorFac}"
type="number" pattern="#,##0.0000" />
</c:otherwise>
</c:choose>
</c:if>
</td>
当调用jsp时,我正在获取foll。控制台出错:
[5/3/17 10:13:14:025 EDT] 00000253 SystemErr R Caused by: javax.el.ELException: Cannot convert 2.34 of type class java.lang.String to class java.lang.Long
[5/3/17 10:13:14:025 EDT] 00000253 SystemErr R at org.apache.el.lang.ELSupport.coerceToNumber(ELSupport.java:497)
[5/3/17 10:13:14:025 EDT] 00000253 SystemErr R at org.apache.el.lang.ELSupport.coerceToNumber(ELSupport.java:476)
[5/3/17 10:13:14:025 EDT] 00000253 SystemErr R at org.apache.el.lang.ELSupport.equals(ELSupport.java:229)
[5/3/17 10:13:14:025 EDT] 00000253 SystemErr R at org.apache.el.parser.AstNotEqual.getValue(AstNotEqual.java:39)
[5/3/17 10:13:14:025 EDT] 00000253 SystemErr R at org.apache.el.parser.AstAnd.getValue(AstAnd.java:37)
[5/3/17 10:13:14:025 EDT] 00000253 SystemErr R at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
值2.34是errorFac的值,它作为路径变量而来,是一个String。我假设c:如果导致问题。请提出任何意见。
答案 0 :(得分:1)
基于这篇文章
你需要将String与String进行比较,零是一个整数,所以:
<c:if test="${mMap['GENERAL'].errorFac != '0' and not empty mMap['GENERAL'].errorFac}">