这是我试图实现的东西。我已经编写了 doGet 方法,现在如何映射 doPost 方法?
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String forward="";
String act = request.getParameter("act");
if (act != null && !act.equalsIgnoreCase("null") &&
act.equalsIgnoreCase("login")) {
forward= "/Login.jsp";
} else if (act!= null && !act.equalsIgnoreCase("null") &&
act.equalsIgnoreCase("register")) {
forward = LIST_USER;
request.setAttribute("users", dao.getAllUsers());
} else {
forward = "/Login.jsp";
}
RequestDispatcher view = request.getRequestDispatcher(forward);
view.forward(request, response);
}