错误代码
Caused by: org.apache.jasper.JasperException: 在 [86] 行处理 [/pages/manager/book_manager.jsp] 时发生异常
83:
84: <%-- 椤电爜杈撳嚭鐨勫紑濮? --%>
85: <%-- 鎯呭喌1锛氬鏋滄?婚〉鐮佸皬浜庣瓑浜?5鐨勬儏鍐碉紝椤电爜鐨勮寖鍥存槸锛?1-鎬婚〉鐮? --%>
86: <c:when test="${requestScope.page.pageTotal <= 5}">
87:
88: <c:forEach begin="1" end="${requestScope.page.pageTotal}" var="i">
89: <c:if test="${i == requestScope.page.pageNo}">
Stacktrace:
at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:599)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:478)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:380)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:328)
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:814)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:223)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:441)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:367)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:295)
at top.qaqaq.web.BookServlet.page(BookServlet.java:40)
... 30 more
Caused by: jakarta.servlet.ServletException: jakarta.servlet.jsp.JspTagException: Illegal use of <when>-style tag without <choose> as its direct parent
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:668)
at org.apache.jsp.pages.manager.book_005fmanager_jsp._jspService(book_005fmanager_jsp.java:433)
原因
<c:choose> <c:when> <c:otherwise>标签
作用:多路判断。跟 switch ... case .... default 非常接近
choose 标签开始选择判断
when 标签表示每一种判断情况
test 属性表示当前这种判断情况的值
otherwise 标签表示剩下的情况
<c:choose> <c:when> <c:otherwise>标签使用时需要注意的点:
1、标签里不能使用 html 注释,要使用 jsp 注释
2、when 标签的父标签一定要是 choose 标签
多路判断没有写 <c:choose> 标签 导致报错
<c:choose>
内部代码
</c:choose>