protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("utf-8");
resp.setCharacterEncoding("utf-8");
String username = req.getParameter("username");
String password = req.getParameter("password");
String[] hobbys = req.getParameterValues("hobbys");
System.out.println("==================打印接收参数值==============================");
System.out.println(username);
System.out.println(password);
System.out.println(Arrays.toString(hobbys));
System.out.println("==================打印接收参数值==============================");
System.out.println(req.getContextPath());
//通过请求转发 req.getRequestDispatcher(req.getContextPath()+"/success.jsp").forward(req,resp); 结果错误 出现两个/s4
//req.getRequestDispatcher("success.jsp").forward(req,resp); //也能到成功登录页面
req.getRequestDispatcher("/success.jsp").forward(req,resp);
}
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("utf-8");
resp.setCharacterEncoding("utf-8");
String username = req.getParameter("username");
String password = req.getParameter("password");
String[] hobbys = req.getParameterValues("hobbys");
System.out.println("==================打印接收参数值==============================");
System.out.println(username);
System.out.println(password);
System.out.println(Arrays.toString(hobbys));
System.out.println("==================打印接收参数值==============================");
System.out.println(req.getContextPath());
//通过请求转发 req.getRequestDispatcher(req.getContextPath()+"/success.jsp").forward(req,resp); 结果错误 出现两个/s4
//req.getRequestDispatcher("success.jsp").forward(req,resp); //也能到成功登录页面
req.getRequestDispatcher("/success.jsp").forward(req,resp);
}
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("utf-8");
resp.setCharacterEncoding("utf-8");
String username = req.getParameter("username");
String password = req.getParameter("password");
String[] hobbys = req.getParameterValues("hobbys");
System.out.println("==================打印接收参数值==============================");
System.out.println(username);
System.out.println(password);
System.out.println(Arrays.toString(hobbys));
System.out.println("==================打印接收参数值==============================");
System.out.println(req.getContextPath());
//通过请求转发 req.getRequestDispatcher(req.getContextPath()+"/success.jsp").forward(req,resp); 结果错误 出现两个/s4
//req.getRequestDispatcher("success.jsp").forward(req,resp); //也能到成功登录页面
req.getRequestDispatcher("/success.jsp").forward(req,resp);
}