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

发布于 2024-09-24 09:53:28 字数 106 浏览 3 评论 0 原文

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

偶尔你会遇到一个错误,你会说:这是什么??标签异常开始< 0.以前见过这个奇迹吗?

javax.servlet.jsp.JspTagException: 'begin' < 0

Once in a while you run into an error and you say: What the WHAT?? tagexception begin < 0. Seen this wonder before??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

芯好空 2024-10-01 09:53:28

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

<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() 以便至少清楚它来自哪里。

I tried to reproduce your exception with the following snippet:

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

I however got a much clearer and self-explaining exception trace in Tomcat's default error page:

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.

Probably there's something wrong with your exception handling or interpretation? It much look like that you're only printing/displaying the e.getMessage() of the root cause in some customized error page and ignoring the remnant of the information of the stacktrace. I'd suggest to add a e.printStackTrace() so that it's at least clear where it is coming from.

秋心╮凉 2024-10-01 09:53:28

'开始' < 0 表示循环需要从大于等于 0 的索引开始
或“循环起始索引不能为负”

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文