HttpServletRequest 对象

包含所有请求的信息,如:请求的来源、标头、cookies和请求相关的参数值等等

获取参数的方法 描述
String getParameter(String name) 取得所传递参数的第一个
Enumeration getParameterNames( ) 取得饮食所有参数名称的 Enumeration 对象
String [] getParameterValues(String name) 取得 name 参数的值数组
Map getParameterMap( ) 取得一个要求参数的 Map
请求标头的方法 描述
String getHeader(String name) 取得name 的标头
Enumeration getHeaderNames() 取得所有的标头名称
Enumeration getHeaders(String name) 取得所有name 的标头
int getIntHeader(String name) 取得整数类型name 的标头
long getDateHeader(String name) 取得日期类型name 的标头
Cookie [] getCookies( ) 取得与请求有关的cookies
其他请求的方法 描述
String getContextPath( ) 取得Context 路径(即站台名称
String getMethod( ) 取得HTTP 的方法(GET、POST
String getProtocol( ) 取得使用的协议 (HTTP/1.1、HTTP/1.0
String getQueryString( ) 取得请求的参数字符串,不过,HTTP的方法必须为GET
String getRequestedSessionId( ) 取得用户端的Session ID
String getRequestURI( ) 取得请求的URL,但是不包括请求的参数字符串
String getRemoteAddr( ) 取得用户的IP 地址
String getRemoteHost( ) 取得用户的主机名称
int getRemotePort( ) 取得用户的主机端口
String getRemoteUser( ) 取得用户的名称
void etCharacterEncoding(String encoding) 设定编码格式,用来解决窗体传递中文的问题