请求转发 :
request.getRequestDispatcher("/demo2").forward(request,response);
解决乱码:
request.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8");
获取请求参数:
获取字符串:request.getParameter("name");
获取多个数据:request.getParameterValues("favor");
获取请求头,请求行,请求路径:
request.getMethod();
request.getHeader("User-Agent");
request.getRequestURI();
共享数据
//存放数据 request.setAttribute("user",name);
//获取数据 request.getAttribute("user");