Filter过滤器中访问getSession()要转化

Filter过滤器中访问getSession()要进行转化:

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest)request;
		HttpServletResponse res = (HttpServletResponse)response;
		
		User user = (User)req.getSession().getAttribute("user");
}

你可能感兴趣的:(Java)