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)
这样就会各自运算各自的