1 <body> 2 <% 3 //获取参数值 4 out.println(request.getParameter("aaa") + "<br/>"); 5 6 out.println("-----------------------------------------------" + "<br/>"); 7 //获取请求头的名字 8 Enumeration<String> h = request.getHeaderNames(); 9 out.println(h); 10 //获取请求头对应的值 11 while(h.hasMoreElements()){ 12 String hh = h.nextElement(); 13 out.println(request.getHeader(hh) + "<br/>"); 14 } 15 16 out.println("-----------------------------------------------" + "<br/>"); 17 request.setCharacterEncoding("GBK"); 18 out.println(request.getParameter("aaa") + "<br/>"); 19 20 out.println("-----------------------------------------------" + "<br/>"); 21 //获取请求头内容 22 String s = request.getQueryString(); 23 out.println(s + "<br/>"); 24 //解码 25 String ss = URLDecoder.decode(s, "utf-8"); 26 out.println(ss + "<br/>"); 27 28 //转发 29 //request.getRequestDispatcher("error.jsp").forward(request, response); 30 //插入页面 31 request.getRequestDispatcher("error.jsp").include(request, response); 32 %> 33 </body>