码迷,mamicode.com
首页 > 其他好文 > 详细

三目运算符

时间:2018-04-05 11:52:39      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:lua   rap   factor   com   nal   异常   encoding   text   main   

page.pageNum+1>page.totalPage?page.totalPage:page.pageNum+1

看着没什么问题,但是会出现转换异常

javax.el.ELException: Error Parsing: ${page.pageNum+1>page.totalPage?page.totalPage:page.pageNum+1}
	org.apache.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:125)
	org.apache.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:146)
	org.apache.el.lang.ExpressionBuilder.createValueExpression(ExpressionBuilder.java:190)
	org.apache.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:68)
	org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:922)
	org.apache.jsp.main_jsp._jspService(main_jsp.java:132)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
	com.itheima.web.controller.ControllerServlet.showIndex(ControllerServlet.java:75)
	com.itheima.web.controller.ControllerServlet.doGet(ControllerServlet.java:44)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
	com.itheima.filter.SetAllCharacterEncodingFilter.doFilter(SetAllCharacterEncodingFilter.java:44)

解决办法:
    page.pageNum+1>page.totalPage?(page.totalPage):(page.pageNum+1)
    这样就会各自运算各自的

三目运算符

标签:lua   rap   factor   com   nal   异常   encoding   text   main   

原文地址:https://www.cnblogs.com/guaishoubiubiu/p/8721215.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!