Cannot convert 0:0 of type class java.lang.String to class java.lang.Long

来源:互联网 发布:阿里云个人备案要多久 编辑:程序博客网 时间:2024/06/10 12:08

 

<----jsp页面内容---->

<span class="sp">订单状态:
          <c:if test="${prop.status == 0}"><font color="#000080">下单登记</font></c:if>
          <c:if test="${prop.status == 1}"><font color="green">支付成功</font><img src="images/g.gif"></c:if>
          <c:if test="${prop.status == 3}"><font color="red">待支付</font><img src="images/X.gif"></c:if>
          <c:if test="${prop.status == 2}"><font color="blue">支付确认</font><img src="images/f.gif"></c:if>
          <c:if test="${prop.status == -1}"><font color="red">支付失败</font><img src="images/X.gif"></c:if>
 </span>

造成错误:

javax.el.ELException: Cannot convert 0:0 of type class java.lang.String to class java.lang.Long
 at org.apache.el.lang.ELSupport.coerceToNumber(ELSupport.java:296)
 at org.apache.el.lang.ELSupport.coerceToNumber(ELSupport.java:275)
 at org.apache.el.lang.ELSupport.equals(ELSupport.java:120)
 at org.apache.el.parser.AstEqual.getValue(AstEqual.java:39)
 at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
 at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:938)
 at org.apache.jsp.pages.si.list_jsp._jspx_meth_c_005fif_005f13(list_jsp.java:750)
 at org.apache.jsp.pages.si.list_jsp._jspx_meth_c_005fforEach_005f0(list_jsp.java:637)
 at org.apache.jsp.pages.si.list_jsp._jspService(list_jsp.java:200)
 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
 at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
 at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
 at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
 at org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:157)
 at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)
 at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:373)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:277)
 at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
 at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)

 

造成原因:status为string型,而页面判断的是整形,所以报错

修改方法:<span class="sp">订单状态:
          <c:if test="${prop.status == ‘0’}"><font color="#000080">下单登记</font></c:if>
          <c:if test="${prop.status == ‘1’}"><font color="green">支付成功</font><img src="images/g.gif"></c:if>
          <c:if test="${prop.status == ‘3’}"><font color="red">待支付</font><img src="images/X.gif"></c:if>
          <c:if test="${prop.status == ‘2’}"><font color="blue">支付确认</font><img src="images/f.gif"></c:if>
          <c:if test="${prop.status == ‘-1’}"><font color="red">支付失败</font><img src="images/X.gif"></c:if>
</span>