request获得行的内容
request.getMethod()
request.getRequestURI()
request.getRequestURL()
request.getContextPath()
request.getRemoteAddr()
request获得头的内容
request.getHeader(name)
request获得体(请求参数)
String request.getParameter(name)
Map<String,String[]> request.getParameterMap();
String[] request.getParameterValues(name);
注意:客户端发送的参数 到服务器端都是字符串
获得中文乱码的解决:
post:request.setCharacterEncoding(“UTF-8”);
get:
parameter = new String(parameter.getBytes(“iso8859-1”),”UTF-8”);
request转发和域
request.getRequestDispatcher(转发的地址).forward(req,resp);