javax.servlet.jsp.JspTagException:'begin'< 0
有一段时间你遇到一个错误而你说:什么是什么? tagexception开始< 0.看到这个奇迹之前??
答案 0 :(得分:2)
我尝试使用以下代码段重现您的例外:
<c:forEach begin="-1" end="1">
<p>blah
</c:forEach>
然而,我在Tomcat的默认错误页面中得到了更清晰且自我解释的异常跟踪:
org.apache.jasper.JasperException: An exception occurred processing JSP page /jsp.jsp at line 12 9: <body> 10: 11: 12: <c:forEach begin="-1" end="1"> 13: <p>bla 14: </c:forEach> 15: Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) root cause javax.servlet.ServletException: javax.servlet.jsp.JspTagException: 'begin' < 0 org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791) org.apache.jsp.jsp_jsp._jspService(jsp_jsp.java:74) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) root cause javax.servlet.jsp.JspTagException: 'begin' < 0 javax.servlet.jsp.jstl.core.LoopTagSupport.validateBegin(LoopTagSupport.java:478) org.apache.taglibs.standard.tag.rt.core.ForEachTag.setBegin(ForEachTag.java:55) org.apache.jsp.jsp_jsp._jspx_meth_c_005fforEach_005f0(jsp_jsp.java:90) org.apache.jsp.jsp_jsp._jspService(jsp_jsp.java:65) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) note The full stack trace of the root cause is available in the Apache Tomcat/6.0.29 logs.
您的异常处理或解释可能有问题吗?看起来你只是在一些自定义错误页面中打印/显示根本原因的e.getMessage()
并忽略堆栈跟踪信息的残余。我建议添加一个e.printStackTrace()
,以便至少清楚它来自哪里。