Detailed explanation of sessions in JSP and analysis of its principles, jspsession

Source: Internet
Author: User

Detailed explanation of sessions in JSP and analysis of its principles, jspsession

Session comprehension in JSP:

I. Session Introduction

In WEB development, the server can create a session object (session Object) for each user's browser. Note: a browser exclusively occupies a session object (by default ). Therefore, when you need to save user data, the server program can write user data to the session exclusively occupied by the user's browser. When you use the browser to access other programs, other programs can extract the user data from the user's session to serve the user.

Ii. Main differences between Session and Cookie

  • Cookie is to write user data to the user's browser.
  • Session technology writes user data to a session exclusively owned by the user.
  • The Session object is created by the server. developers can call the getSession method of the request object to obtain the session object.

Iii. session implementation principle

How does a server implement a session to serve a user's browser? After a session is created on the server, the session ID will be sent back to the client in the form of a cookie. In this way, when the client's browser is disabled, the session ID will be carried when accessing the server, when the server finds that the client browser has brought the session id, it will use the corresponding session in the memory to serve it.

If you have any questions, please leave a message or go to the community on this site for discussion. Thank you for reading this article. Thank you for your support!

Related Article

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.