更新(2019.12.03):
两个挺蠢的语句,记录下吧,以后回顾
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
response.setContentType("text/html; charset=UTF-8");
PrintWriter out = response.getWriter();
String username = request.getParameter("username") ;
out.print("<script>alert('发送成功,请按提示操作。。') ;window.location='index.jsp'</script>");
response.sendRedirect("login1?id="+per.getUserid()+"&psd="+per.getPsd()+"") ;
1.request请求转发
- request跳转页面同时传值
String name = "haiyou1";
request.setAttribute("name", name);
request.getRequestDispatcher("/WEB-INF/new1.jsp").forward(request,response);
- request跳转页面后获取值
String name = request.getAttribute("name");
2.response重定向
response.sendRedirect("success.jsp") ;