出现的错误:
Type Exception Report
Message /cart.jsp (line: [32], column: [45]) The JSP specification requires that an attribute name is preceded by whitespace
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
org.apache.jasper.JasperException: /cart.jsp (line: [32], column: [45]) The JSP specification requires that an attribute name is preceded by whitespace org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:41) org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:291) org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:97) org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:170) org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:159) org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1251) org.apache.jasper.compiler.Parser.parseElements(Parser.java:1470) org.apache.jasper.compiler.Parser.parse(Parser.java:144) org.apache.jasper.compiler.ParserController.doParse(ParserController.java:244) org.apache.jasper.compiler.ParserController.parse(ParserController.java:105) org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:202) org.apache.jasper.compiler.Compiler.compile(Compiler.java:373) org.apache.jasper.compiler.Compiler.compile(Compiler.java:350) org.apache.jasper.compiler.Compiler.compile(Compiler.java:334) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:595) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:399) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330) javax.servlet.http.HttpServlet.service(HttpServlet.java:742) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Note The full stack trace of the root cause is available in the server logs.
出现错误的代码:
<c:forEach items="${order.map}"var="item">
原因:"${order.map}"的后面,var的前面要有空格;但是这种错误有时才会出现,有时不会出现。
总结:jstl 的语句没有html那么有随意性,当出现jstl语句错误时 ,应该要查询官方文档,或者很难在小细节中发现错误
还有一种情况是${order.map }" 里面的map后面不能有空格否则也会出现错误;
原文地址:https://www.cnblogs.com/czc268/p/10667070.html
时间: 2024-10-09 15:55:31