你先把过滤器new出来,再调用不就好了
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=gbk");
PrintWriter out = response.getWriter();
String name = request.getParameter("username");
String password = request.getParameter("password");
HttpSession session = request.getSession();
if(name.equals("凯陵admain") && password.equals("admain")){
session.setAttribute("兄唤usertype", "admain");
Fileter f=new Fileter();
f.doFilter(request,response,chain);//反正羡孙凯你先把过滤器new出来,再调用不就好了,具体的属性看实际情况,我是手写代码,难免有错
}else{
out.print("用户页面");
}
}
把session设置成整个网站的。。。。。。。。