2017-05-03 52 views
0

我在JSP代码如下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的值,它作为路径变量出现并且是字符串。我假设c:如果是造成这个问题。请输入任何内容。

+0

[串地龙比较可能的复制抛出“ELException:不能转换“在Tomcat 7中,在Tomcat 6中工作](http://stackoverflow.com/questions/25274458/string-to-long-comparison-throws-elexception-cannot-convert-in-tomcat-7-work) –

回答

1

基于这个帖子

String to long comparison

你需要比较串来串,零是一个整数,所以:

<c:if test="${mMap['GENERAL'].errorFac != '0' and not empty mMap['GENERAL'].errorFac}">