Four ranges of JSPs

Source: Internet
Author: User
Tags ranges

JSP four kinds of scopes, respectively page, request, session, application.

All four can be used setattribute ("," "); GetAttribute ("", ""); where page is used, Pagecontext.setattribute ("", "" ");

Page: Scopes are limited to the current Page object, which is valid only on the same page. When you leave the current JSP page (either redirect or forward), all property values in the PageContext are lost.

Request: The scope is within the same request, when the page jumps, if the forward way to jump, then the forward target page can still get the property value in Request. If the page jumps by redirect, the value of the attribute in the request is lost in this scenario because redirect is the equivalent of a re-issued request.

Session: The scope is the duration of the user and the server is connected to the time, but disconnected from the server, this property is invalid

Application: The global scope, the entire application is shared, the scope is the largest, as long as the server does not stop, the Application object exists.

Four ranges of JSPs

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.