Jsp built-in object-session, jsp built-in-session

Source: Internet
Author: User

Jsp built-in object-session, jsp built-in-session

Introduction to built-in session objects

Personally, the session is unique,

A session is a request-related session. It is a java. servlet. http. HttpSession object used to represent and store the request information of the current page. Session is also one of the objects frequently used in JSP development. It usually sets a 30-minute expiration time on the server. After the client stops the operation for 30 minutes, the information stored in the session will automatically expire.
Note that the stored and searched information in the session cannot be of the basic type, such as int or double, but must be an object corresponding to Java, such as Integer or Double.

Common Methods of session objects

GetId (): returns a unique identifier generated for each session. When only one single value is associated with a session, or when the log information is related to the previous session, it is used as a key name.


GetCreationTime (): return the time when the session was created.
GetLastAccessedTime (): return the time when the session was last sent by the customer. The minimum unit is milliseconds (MS ).
GetMaxInactiveInterval (): Total time (seconds) returned. A negative value indicates that the session will never time out.
GetAttribute (String key): obtains the information stored in the session with the specified keyword. For example, Integer item = (Integer) session. getAttribute ("item ").
SetAttribute (String key, Object obj): provides a keyword and an Object value, which then exists in the session. For example, session. setAttribute ("item", itemName ).

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.