Methods In the httpsession interface (Session class usage in JSP)

Source: Internet
Author: User
Httpsession is similar to the hash table interface. It provides the setattribute () and getattribute () Methods to store and retrieve objects. Httpsession provides a session ID keyword. A client that participates in session behavior stores and returns it in the same session request. The servlet engine searches for appropriate session objects and makes them available to the current request.
Object getattribute (string name) saves an object in a session as the specified name, and returns or deletes the previously saved name object.
Void setattribute (string name, object Value) sets the session object
Void removeattribute (string name) deletes the session object
Enumeration getattributename () returns the enumerated values of all attribute names bound to the current session.
Long getcreationtime () returns a long integer that represents the session creation and last access date and time. This integer is used in the Java. util. Date () constructor.
Long getlastaccessedtime ()
String GETID () returns the session ID, a unique keyword set by the servlet engine.
If int getmaxinactiveinterval () does not interact with the client, set and return the maximum number of seconds for session survival.
Void setmasinactiveinterval (INT seconds)
Void invalidate () causes the session to be terminated and any objects are released.
Boolean isnew () returns true if the client is not added to the session. When a session is created for the first time and the session ID is passed into the client, but the client does not perform the second request containing the session ID, true is returned. # Java Column

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.