|
|
|
@ -11,25 +11,34 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @ClassName: MemberLoginOutServlet
|
|
|
|
|
* @Description: 会员 退出登陆
|
|
|
|
|
* @Description: 会员退出登录的Servlet
|
|
|
|
|
* @author ljy
|
|
|
|
|
* @date 2019年11月14日 下午3:37:12
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
public class MemberLoginOutServlet extends HttpServlet {
|
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
|
|
|
|
|
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
|
|
|
|
throws ServletException, IOException {
|
|
|
|
|
|
|
|
|
|
// 销毁session
|
|
|
|
|
request.getSession().invalidate();
|
|
|
|
|
|
|
|
|
|
// 提示信息,返回首页
|
|
|
|
|
PrintWriter out = response.getWriter();
|
|
|
|
|
out.write("<script>alert('登出成功!');" + "window.location.href='pages/user/home.jsp'</script>");
|
|
|
|
|
out.close();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 处理GET请求的方法。
|
|
|
|
|
* 当客户端发送GET请求到此Servlet时,这个方法会被调用。
|
|
|
|
|
* @param request HttpServletRequest对象,包含客户端请求信息。
|
|
|
|
|
* @param response HttpServletResponse对象,用于发送响应到客户端。
|
|
|
|
|
* @throws ServletException 可能抛出的Servlet异常。
|
|
|
|
|
* @throws IOException 可能抛出的IO异常。
|
|
|
|
|
*/
|
|
|
|
|
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
|
|
|
|
throws ServletException, IOException {
|
|
|
|
|
|
|
|
|
|
// 销毁当前用户的session,使得用户登出
|
|
|
|
|
request.getSession().invalidate();
|
|
|
|
|
|
|
|
|
|
// 获取PrintWriter对象用于向客户端发送JavaScript代码
|
|
|
|
|
PrintWriter out = response.getWriter();
|
|
|
|
|
// 输出JavaScript代码,用于弹出提示信息,并重定向到首页
|
|
|
|
|
out.write("<script>alert('登出成功!');" + "window.location.href='pages/user/home.jsp'</script>");
|
|
|
|
|
// 关闭PrintWriter对象
|
|
|
|
|
out.close();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|