El Four Scopes 9 JSP object valid range and corresponding class

Source: Internet
Author: User

?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 java中request,session,application的作用范围     page,request,session,application四者的作用范围:         page的作用范围是当前页面;对应El表达式的pageScope    request的作用范围是页面与页面之间的传递就是请求请求结束则结束; 对应El表达式的requestScope    session的作用范围是直到关闭浏览器;对应El表达式的sessionScope    application的作用范围是关闭服务器;对应El表达式的applicationScopeapplication不是JAVA上的...是JSP中的对应java中的ServletContext类...    它和page request session application response out config exception pageContext都是JSP中的9个内置对象...    在后台用ServletContext存储的属性数据可jsp页面以用application对象获得..    而且application的作用域是整个Tomcat启动的过程...    例如: ServletContext.setAttribute("username",username);    则在JSP网页中可以使用  application.getAttribute("username");来得到这个用户名application与pageContext都是jsp9个对象的成员,     application是servletContext类的实例,         pageContext是PageContext类的实例,         使用pageContext可以访问page request session application response out config exception范围的变量。    意思就是在项目中jsp页面可以用pageContext调用到其它8个jsp内置对象的一切。 JSP共有以下9种基本内置组件:      request  用户端请求,此请求会包含来自GET/POST请求的参数   对应HttpServletRequest类    response     网页传回用户端的回应                   对应HttpServletResponse类     pageContext  网页的属性是在这里管理              对应PageContext类     session      与请求有关的会话期                    对应HttpSession类     application  servlet正在执行的内容               对应ServletContext类     out          用来传送回应的输出                    对应JspWrite类     config       servlet的构架部件                 对应ServletConfig类     page         JSP网页本身                      对应this     exception    针对错误网页,未捕捉的例外                   对应Throwable接口

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.