核心用法 引入其它页面 jsp:include page="head.jsp"/jsp:include 过滤器处理数据 package filter;import javax.servlet.*;import javax.servlet.annotation.WebFilter;import java.io.IOException;@WebFilter(value = "/head.jsp", dispatc
核心用法
引入其它页面
<jsp:include page="head.jsp"></jsp:include>
过滤器处理数据
package filter;import javax.servlet.*;import javax.servlet.annotation.WebFilter;import java.io.IOException;@WebFilter(value = "/head.jsp", dispatcherTypes = DispatcherType.INCLUDE)public class AFilter implements Filter { @Override public void init(FilterConfig filterConfig) throws ServletException { } @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { System.out.println("in2"); servletRequest.setAttribute("db", "jsp-include"); filterChain.doFilter(servletRequest, servletResponse); System.out.println("out2"); } @Override public void destroy() { }}