Cannot convert 0:0 of type class java.lang.String to class java.lang.Long
2013-04-11 11:41
567 查看
<----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>
<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>
相关文章推荐
- Cannot convert 临时用户 of type class java.lang.String to class java.lang.Long
- Cannot convert 2014-08-04 00:00:00.0 of type class java.lang.String to class java.util.Date
- javax.el.ELException: Cannot convert 2015-12-03 18:50 of type class java.lang.String to class java.u
- javax.el.ELException: Cannot convert 1 of type class java.lang.String to int
- jsf配置问题 Error performing conversion of value ' of type class java.lang.String to type class
- javax.el.ELException: Cannot convert 1 of type class java.lang.Integer to class java.lang.Boolean
- javax.el.ELException: Cannot convert 1 of type class java.lang.Integer to class java.lang.Boolean
- Cannot convert 0 of type class java.lang.Integer to class java.lang.Boolean
- Failed to convert property value of type [java.lang.String] to required type [java.util.Date] for pr
- FAQ(69):java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required
- Value of type java.lang.String cannot be converted to JSONObject
- 表单提交时候"Failed to convert property value of type [java.lang.String] to
- 配置Spring Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource]
- spring mvc 数据绑定报错 Failed to convert property value of type 'java.lang.String' to required type 'int'
- Value of type java.lang.String cannot be converted to JSONObject
- Err:The "." operator was supplied with an index value of type "java.lang.String" to be applied to a List or array
- spring Failed to convert property value of type 'java.lang.String' to required type 'int' for proper
- Unable to find a value for "字段名" in object of class java.lang.String using operator "."
- org.json.JSONException: Value ok of type java.lang.String cannot be converted to JSONObject: [Caugh
- Mina报 Don't know how to handle message of type 'java.lang.String'异常