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 ).