protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(); // la lógica de logueo está en el serivicio de login (LoginService) que devuelve un string con // la pantalla para el forward request .getRequestDispatcher(LoginService.validateLoginData(request, session)) .forward(request, response); }
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String action = request.getParameter("action"); if ("terminate".equals(action)) { // El usuario solicita desloguearse LoginService.closeSession(request); request.setAttribute("user", null); request.getRequestDispatcher("/index.jsp").forward(request, response); } }