五个有用的过滤器
一、使浏览器不缓存页面的过滤器
import
javax.servlet.*;
import
javax.servlet.http.HttpServletResponse;
import
java.io.IOException;
public class ForceNoCacheFilter implements Filter
{
public void doFilter(ServletRequest request, ServletResponse
response, FilterChain filterChain) throws IOException,
ServletException
{
}
public void
destroy()
{
}
{
}
}
二、检测用户是否登陆的过滤器
import
javax.servlet.*;
import
javax.servlet.http.HttpServletRequest;
import
javax.servlet.http.HttpServletResponse;
import
javax.servlet.http.HttpSession;
import
java.util.List;
import
java.util.ArrayList;
import
java.util.StringTokenizer;
import
java.io.IOException;
public class
CheckLoginFilter
implements
Filter
{
public void doFilter(ServletRequest servletRequest, ServletResponse
servletResponse, FilterChain filterChain) throws IOException,
ServletException
{