Java meets html--jsp article: JSP built-in objects (bottom)

Source: Internet
Author: User

What is a session?
    • Session represents a client-to-server conversation
    • The session in the Web refers to the amount of time that a user has spent browsing a website, from entering the site to the browser closing, that is, the time it takes for the user to browse the site.
    • As you can see from the above definition, the session is actually a specific time concept
    • The session of different users is stored inside the server
Session Object
    • The session object is a JSP built-in object.
    • The session object is created automatically when the first JSP page is loaded, and sessions management is completed.
    • Open a browser from a client and connect to the server to start, to the client close the browser to leave the end of this server, known as a session.
    • When a client accesses a server, it may switch between several pages of the server, and the server should know by some means that it is a client and needs a session object.
    • The session object is an instance of the Htppsession class.
The following are common methods for session objects:

The life cycle of the session

Create: When a client accesses a JSP or servlet for the first time, the server creates a SessionID for the current session, and each time the client sends a request to the server, it carries the SessionID in the past. This seesionid will be verified by the server.

Activities:

    • A new page that is opened by a hyperlink in a session belongs to the same session.
    • As long as the current session page does not close all, reopen the new browser window to access the same project resource when it belongs to the same session.
    • Unless all the pages of this session are closed and then re-access a JSP or the servlet will create a new session.

Note: Note that the original session still exists, but the old SessionID still exist on the server, but no more clients carry it and then to the server check.

Destroyed:

There are only three ways to destroy a session:

1, call the Session.invalidate () method

2. Session expires (Timeout)

3. Server restart

Application object:

Common methods for application objects are as follows:

Page Object

PageContext Object

Common methods for PageContext objects are as follows:

Config object

Exception Object

Java meets html--jsp article: JSP built-in objects (bottom)

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.