手机站
网通分站
电信主站
密 码:
用户名:
当前位置 : 主页>程序设计>Java技术>列表

JSP内建对象

来源:互联网 作者:west263.com 时间:2008-02-23
西部数码-全国虚拟主机10强!40余项虚拟主机管理功能,全国领先!双线多线虚拟主机南北访问畅通无阻!免费赠送企业邮局,.CN域名,自助建站480元起,免费试用7天,满意再付款! P4主机租用799元/月.月付免压金!

12. boolean isNew() ;
判断一个session是否由服务器产生,但是客户端并没有使用。

13. void pubValue( String name, Object value ) ;
添加一个session变量,不推荐使用。

14. void removeValue( String name ) ;
移除一个session变量的值,不推荐使用。

15. void setAttribute( String name, String value ) ;
设置指定名称的session属性值。

16. void setMaxInactiveInterval( int interval ) ;
设置session的有效期。

17. void removeAttribute( String name ) ;
移除指定名称的session属性。


⑤ pageContext - javax.servlet.jsp.PageContext
pageContext对象存储本JSP页面相关信息,如属性、内建对象等。

方法:
1. void setAttribute( String name, Object value, int scope ) ;
void setAttribute( String name, Object value ) ;
在指定的共享范围内设置属性。

2. Object getAttribute( String name, int scope ) ;
Object getAttribute( String name ) ;
取得指定共享范围内以name为名字的属性值。

3. Object findAttribute( String name ) ;
按页面、请求、会话和应用程序共享范围搜索已命名的属性。

4. void removeAttribute( String name, int scope ) ;
void removeAttribute( String name ) ;
移除指定名称和共享范围的属性。

5. void forward( String url ) ;
将页面导航到指定的URL。

6. Enumeration getAttributeNamesScope( int scope ) ;
取得指定共享范围内的所有属性名称的集合。

7. int getAttributeScope( String name ) ;
取得指定属性的共享范围。

8. ErrorData getErrorDate() ;
取得页面的errorData对象。

9. Exception getException() ;
取得页面的exception对象。

10. ExpressionEvaluator getExpressionEvaluator() ;
取得页面的expressionEvaluator对象。

11. JspWriter getOut() ;
取得页面的out对象。

12. Object getPage() ;
取得页面的page对象。

13. ServletRequest getRequest() ;
取得页面的request对象。

14. ServletResponse getResponse() ;
取得页面的response对象。

15. ServletConfig getConfig() ;
取得页面的config对象。

16. ServletContext getServletContext() ;
取得页面的servletContext对象。

17. HttpSession getSession() ;
取得页面的session对象。

18. VariableResolver getVariableResolver() ;
取得页面的variableResolver对象。

19. void include( String url, boolean flush ) ;
void include( String url ) ;
包含其他的资源,并指定是否自动刷新。

20. void release() ;
重置pageContext内部状态,释放所有内部引用。

21. void initialize( Servlet servlet, ServletRequest request, ServletResponse response,
String errorPageURL, boolean needSession, int bufferSize, boolean autoFlush ) ;
初始化未经初始化的pageContext对象。

22. BodyContext pushBody() ;
BodyContext pushBody( Writer writer ) ;
保存当前的out对象,并更新pageContext中page范围内的out对象。

23. JspWrite popBody() ;
取出由pushBody()方法保存的out对象。

24. void handlePageException( Exception e ) ;
void handlePageException( Thrwoable t ) ;

成员:
int PAGE_SCOPE = 1 - 页面共享范围
int REQUEST_SCOPE = 2 - 请求共享范围
int SESSION_SCOPE = 3 - 会话共享范围
int APPLICATION_SCOPE = 4 - 应用程序共享范围
String PAGE = "javax.servlet.jsp.jspPage"
String PAGECONTEXT = "javax.servlet.jsp.jspPageContext"
String REQUEST = "javax.servlet.jsp.jspRequest"
String RESPONSE = "javax.servlet.jsp.jspResponse"
String CONFIG = "javax.servlet.jsp.jspConfig"
String SESSION = "javax.servlet.jsp.jspSession"
String OUT = "javax.servlet.jsp.jspOut"
String APPLICATION = "javax.servlet.jsp.jspApplication"
String EXCEPTION = "javax.servlet.jsp.jspException"


⑥ application - javax.servlet.ServletContext
application主要功用在于取得或更改Servlet的设定。

方法:
1. Object getAttribute( String name ) ;
返回由name指定的application属性。

文章整理:西部数码--专业提供域名注册虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!