www.pudn.com > bookshop.zip > LogOutServlet.java, change:2013-07-08,size:749b


package com.tarena.web; 
 
import java.io.IOException; 
import java.io.PrintWriter; 
 
import javax.servlet.ServletException; 
import javax.servlet.http.HttpServlet; 
import javax.servlet.http.HttpServletRequest; 
import javax.servlet.http.HttpServletResponse; 
import javax.servlet.http.HttpSession; 
 
public class LogOutServlet extends HttpServlet { 
 
	public void service(HttpServletRequest request, HttpServletResponse response) 
			throws ServletException, IOException { 
		request.setCharacterEncoding("utf-8"); 
        response.setContentType("text/html;charset=utf-8"); 
         
        HttpSession session=request.getSession(); 
        session.setAttribute("user",null); 
        response.sendRedirect("BookListServlet"); 
 
	} 
 
}