javax.servlet.jsp.JspTagException:'开始'< 0

问题描述 投票:0回答:2

javax.servlet.jsp.JspTagException:'开始'< 0

偶尔你会遇到一个错误,你会说:这是什么??标记异常开始 < 0. Seen this wonder before??

java exception servlets jstl jsp-tags
2个回答
2
投票

我尝试使用以下代码片段重现您的异常:

<c:forEach begin="-1" end="1">
    <p>blah
</c:forEach>

但是,我在 Tomcat 的默认错误页面中得到了更清晰且不言自明的异常跟踪:

org.apache.jasper.JasperException:在第 12 行处理 JSP 页面 /jsp.jsp 时发生异常

9:
10:
11:
12:
13:

布拉 14: 15: 堆栈跟踪: 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) 根本原因 javax.servlet.ServletException:javax.servlet.jsp.JspTagException:'开始'< 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()
,这样至少可以清楚它来自哪里。


0
投票

‘开始’< 0 Says, Loop Needs to Starts from index greater than equal to 0 or 'Loop Starting Index cannot be Negative'

© www.soinside.com 2019 - 2024. All rights reserved.