logoutaction.java

来自「JAVA Servlet2.3外文书籍源码」· Java 代码 · 共 32 行

JAVA
32
字号
package forum;

import java.io.IOException;

import javax.servlet.*;
import javax.servlet.http.*;

/**
 * Represents the logic behind logging out the user. This action
 * is responsible for invalidating the HTTP session.
 *
 * @author    Simon Brown
 */
public class LogoutAction extends Action {

  /**
   * Peforms the processing associated with this action.
   *
   * @param request     the HttpServletRequest instance
   * @param response    the HttpServletResponse instance
   * @return  the name of the next view
   */
  public String process(HttpServletRequest request, HttpServletResponse response) {

    System.out.println("LogoutAction : Processing request");

    request.getSession().invalidate();

    return "/index.jsp";
  }

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?