注销登录

注销登录用户的后台

package com.liuzm.mypss.web;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

public class LogoutAction extends BaseAction {

	@Override
	public String execute() throws Exception {
		HttpSession session = ServletActionContext.getRequest().getSession();
		session.removeAttribute(LOGIN_USER);
		session.invalidate();
		HttpServletResponse response = ServletActionContext.getResponse();
		response.sendRedirect("/index.jsp");
		// System.out.println("session是否被销毁:::"+session==null);
		return NONE;
	}
}

 

 

你可能感兴趣的:(登录)