я использую TagLib подойти мой файл destination.my TagLib был написан, как показано ниже:JSP: атрибут должен быть подэлемент стандартного или пользовательского действия
<%@ attribute name="header" fragment="true" required="false" %>
<%@ attribute name="footer" fragment="true" required="false" %>
<%@ attribute name="styles" fragment="true" required="false" %>
<%@ attribute name="scripts" fragment="true" required="false" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../lib/bootstrap-paper/bootstrap.css" />
<link rel="stylesheet" href="../lib/toastr/toastr.css" />
<link rel="stylesheet" href="../lib/sweetalert/dist/sweetalert.css" />
<link rel="stylesheet" href="../lib/famfamfam-flags/dist/sprite/famfamfam-flags.css" />
<link rel="stylesheet" href="../lib/slick/slick.css" />
<link rel="stylesheet" href="../lib/slick/slick-theme.css" />
<link rel="stylesheet" href="../css/main.css" />
<link rel="stylesheet" href="../Content/sweetalert.css"/>
<%--<jsp:invoke fragment="styles" />--%>
<script src="//cdn.bootcss.com/angular.js/1.2.9/angular.js"></script>
<script src="//cdn.bootcss.com/angular.js/1.2.9/angular-route.js"></script>
</head>
<body>
<div id="pageheader">
<jsp:invoke fragment="header" />
</div>
<div id="body" class="body-content">
<jsp:doBody />
</div>
<div id="pagefooter">
<jsp:invoke fragment="footer" />
</div>
<jsp:invoke fragment="scripts" />
</body>
моя страница запроса, как показано ниже:
<%@ page language="java" import="java.util.*,com.ppdai.vip.dto.*" pageEncoding="UTF-8" isELIgnored="false" %>
<%@ page import="com.ppdai.user.tuple.Tuple" %>
<%@ page import="ppdai.user.web.util.PropertyUtil" %>
<%@taglib prefix="t" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%
String title="首页";
List<HomePageAdDto> bannerList=
(List<HomePageAdDto>)request.getAttribute("IndexAdBanner");
List<GoodsTypeDto> goodTypes=(List<GoodsTypeDto>)request.getAttribute("GoodTypes");
String ssoKey=PropertyUtil.getSsoKey();
String callBackUrl= PropertyUtil.getCallBackUrl();
String requestUrl=request.getRequestURL().toString();
%>
<t:genericpage>
<%--<jsp:attribute name="styles">--%>
<%--</jsp:attribute>--%>
<jsp:attribute name="header">
<jsp:include page="view/header.jsp" />
</jsp:attribute>
<jsp:body>
1111
</jsp:body>
<jsp:attribute name="footer">
<jsp:include page="view/footer.jsp" />
</jsp:attribute>
</t:genericpage>
исключение occued когда запрос действия контроллера SpringMVC в:
org.apache.jasper.JasperException: /WEB-INF/index.jsp (line: 32, column: 9) jsp:attribute must be the subelement of a standard or custom action
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:41)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:275)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:91)
org.apache.jasper.compiler.Parser.parseStandardAction(Parser.java:1146)
org.apache.jasper.compiler.Parser.parseElementsScriptless(Parser.java:1508)
org.apache.jasper.compiler.Parser.parseBody(Parser.java:1676)
org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:1006)
org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1281)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1460)
org.apache.jasper.compiler.Parser.parse(Parser.java:139)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:227)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:199)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:356)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:336)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:323)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:585)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:363)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:264)
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1208)
org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:992)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:939)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
, когда я обновить страницу, то другое исключение будет отображаться мне:
java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.index_jsp
org.apache.jasper.JasperException: java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.index_jsp
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:176)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:264)
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1208)
org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:992)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:939)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
моя файловая структура, как это:
мой пОМ ссылка как это:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet.jsp/javax.servlet.jsp-api -->
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
<version>1.2</version>
</dependency>