核心用法
引入其它页面
<jsp:include page="head.jsp"></jsp:include>
过滤器处理数据
package filter;标签:数据,void,System,Override,过滤器,import,servletRequest,public,加载 From: https://blog.51cto.com/u_13137233/5926319
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() {
}
}