[size=small][color=brown][b]Request内置对象[/b][/color][/size]
[i]Request是最常用的内置对象,表示javax.servlet.http.HttpServletRequest对象[/i]
[color=indigo][i]它包含所有请求的信息,如请求的来源、标头、cookies和请求相关的参数值等[/i]
[/color]
[list]
[*]Object getAttribute(String name):返回由name指定的属性值,该属性不存在时返回null
[*]void setAttribute(String name,Object value):在属性列表中添加/删除指定的属性
[*]String getParameter(String name):获取客户端发送给服务器端的参数值
[*]String[] getParameterValues(String name):获得请求中指定参数的所有值
[*]String getProtocol():返回请求使用的协议,可以是HTTP1.1或者HTTP1.0
[*]String RequestURI():返回发出请求的客户端地址,但是不包括请求的参数字符串
[*]String getRemoteAddr():获取发出请求的客户端IP地址
[*]HttpSession getSession():获取session
[/list]
[i]Request是最常用的内置对象,表示javax.servlet.http.HttpServletRequest对象[/i]
[color=indigo][i]它包含所有请求的信息,如请求的来源、标头、cookies和请求相关的参数值等[/i]
[/color]
<html>
<head>
<title>Request内置对象演示示例</title>
</head>
<body>
欢迎您: <!--显示用户名-->
<%=request.getParameter("username")%>
<br/> <!--显示协议-->
<%=request.getProtocol()%>
<br/> <!--显示请求的地址-->
<%=request.getRequestURI()%>
<br/> <!--显示地址-->
<%=request.getRemoteAddr()%>
</body>
</html>
[list]
[*]Object getAttribute(String name):返回由name指定的属性值,该属性不存在时返回null
[*]void setAttribute(String name,Object value):在属性列表中添加/删除指定的属性
[*]String getParameter(String name):获取客户端发送给服务器端的参数值
[*]String[] getParameterValues(String name):获得请求中指定参数的所有值
[*]String getProtocol():返回请求使用的协议,可以是HTTP1.1或者HTTP1.0
[*]String RequestURI():返回发出请求的客户端地址,但是不包括请求的参数字符串
[*]String getRemoteAddr():获取发出请求的客户端IP地址
[*]HttpSession getSession():获取session
[/list]