The difference and similarity of JSP about resquest and session and application

Source: Internet
Author: User

1. The setattribute and GetAttribute methods of the request are generally paired, first set the property and property values through the SetAttribute method, and then

The GetAttribute method gets the object value corresponding to the property based on the property ( generally requires a down-type conversion to convert the property value to a real object ). Both the setattribute and GetAttribute methods are performed internally on the server side, and the client does not know whether the server has performed these two methods.

2. The function of the GetParameter method of the request is to obtain a parameter value sent to the client via a form or URL request parameter. is the interaction between the client and server side, the server to obtain the data sent to the client, you need to use the GetParameter method to obtain, there is no Setparameter method corresponding to the GetParameter method.

3. The scope of the data within the request object is within the scope of the request object's survival, when the client sends a request to the server, the server returns a response to the client, the request object is destroyed, and then a new request is sent to the server side. The server creates a new request object that has no relationship to the request object before the request object, and therefore cannot obtain any data stored in the previous request object.

The survival range of the data within the 4.session object is the survival range of the Session object (* * * * * * * * * * * * * * * * * * * * * * * * * * No matter how many requests are sent to the server, there is only one session object (note: That is, the value you put in will always exist in the session object, as long as your browser does not close (it feels like a queue)).

Summary: For example, request and session each set a hyperlink, but request cannot get the value of the original page, but the session can ...

5. Application (Application Object): The object with the largest surviving range, as long as the server is not closed, the data in the Application object will persist. During the entire server run, there is only one application object.

The difference and similarity of JSP about resquest and session and application

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.