public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String userName = request.getParameter("userName"); String password = request.getParameter("password"); if (login(userName, password)) { RequestDispatcher rd = request.getRequestDispatcher("AnotherServlet"); rd.forward(request, response); } else { sendLoginForm(response, true); } }