日期:2014-05-16  浏览次数:20349 次

JSP的九个隐含对象,EL表达式中的11个隐含对象,JSP的6个基本动作

复习一下,基础都快忘了

一、page 对象
??? page对象代表JSP本身,更准确地说它代表JSP被转译后的Servlet,它可以调用Servlet类所定义的方法。
????????
?二、config 对象
??? config 对象里存放着一些Servlet 初始的数据结构。
??? config 对象实现于javax.servlet.ServletConfig 接口,它共有下列四种方法:
??????? public String getInitParameter(name)
??????? public java.util.Enumeration getInitParameterNames( )
??????? public ServletContext getServletContext( )
??????? public Sring getServletName( )

三、request 对象
??? request 对象包含所有请求的信息,如:请求的来源、标头、cookies和请求相关的参数值等等。
??? request 对象实现javax.servlet.http.HttpServletRequest接口的,所提供的方法可以将它分为四大类:
??? 1.储存和取得属性方法;
??????? void setAttribute(String name, Object value)??? 设定name属性的值为value
??????? Enumeration getAttributeNamesInScope(int scope)??? 取得所有scope 范围的属性
??????? Object getAttribute(String name)??????????????? 取得name 属性的值
??????? void removeAttribute(String name)??????????????? 移除name 属性的值
??? 2.取得请求参数的方法
??????? String getParameter(String name)??????????????? 取得name 的参数值
??????? Enumeration getParameterNames( )??????????????? 取得所有的参数名称
??????? String [] getParameterValues(String name)???????? 取得所有name 的参数值
??????? Map getParameterMap( )???????????????????????????? 取得一个要求参数的Map
??? 3.能够取得请求HTTP 标头的方法
??????? 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
??? 4.其他的方法
??????? 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)??????? 设定编码格式,用来解决窗体传递中文的问题

四、response 对象
??? response 对象主要将JSP 处理数据后的结果传回到客户端。
??? response 对象是实现javax.servlet.http.HttpServletResponse 接口。response对象所提供的方法。
??? 1.设定表头的方法
??????? void addCookie(Cookie cookie)???????????????????? 新增cookie
??????? void addDateHeader(String name, long date)??????? 新增long类型的值到name标头
??????? void addHeader(String name, String value)??????? 新增String类型的值到name标头
??????? void addIntHeader(String name, int value)???????? 新增int类型的值到name标头
??????? void setDateHeader(String name, long date)??????? 指定long类型的值到name标头
??????? void setHeader(String name, String value)??????? 指定String类型的值到name标头
??????? void setIntHeader(String name, int value)???????? 指定int类型的值到name标头
??? 2.设定响应状态码的方法
??????? void sendError(int sc)???????????????????????????? 传送状态码(status code)
??????? void sendError(int sc,