"Javaweb" Learning note five JSP built-in objects (bottom)

Source: Internet
Author: User
Tags object object stack trace throwable unique id

1.session

Session object refers to a client-to-server conversation

Start with a webapplication from the customer connection to the server

Until the client disconnects from the server. It is an instance of the HttpSession class

Number Method Description
1 Long GetCreationTime () return session creation Time
2 Public String getId () Returns the unique ID number that the JSP engine sets for the session when it is created
3 Long Getlastaccessedtime () Returns the client's last request time in this session
4 int Getmaxinactiveinterval () Returns the two request interval how long this session was canceled (MS)
5 String[] GetValueNames () Returns an array containing all the properties available in this session
6 void Invalidate () Cancel session to make session unavailable
7 Boolean isnew () Returns a session created by the server, whether the client has joined
8 void RemoveValue (String name) Delete the properties specified in the session
9 void SetAttribute (String key,object obj) Set the properties of the session

Session Set timeout time

2.application

The Application object realizes the sharing of data among users and can store global variables. It starts at the start of the server until the server shuts down, during which time this object will persist, so that the same properties of the object can be manipulated in the connection between the user's back-and-forth or different users The operation of this object property anywhere will affect access by other users. The start and shutdown of the server determines the life of the Application object. It is an instance of the ServletContext class

Number Method Description
1 Object getattribute (String name) Returns the property value for the given name
2 Enumeration Getattributenames () Returns an enumeration of all available property names
3 void SetAttribute (String name,object obj) Setting property values for a property
4 void RemoveAttribute (String name) Delete an attribute and its property value
5 String Getserverinfo () Returns the JSP (SERVLET) engine name and version number
6 String Getrealpath (String path) Returns the true path of a virtual path
7 ServletContext getcontext (String uripath) Returns the Application object for the specified WebApplication
8 int Getmajorversion () Returns the maximum version number of the Servlet API supported by the server
9 int Getminorversion () Returns the minimum version number of the Servlet API supported by the server
10 String GetMimeType (String file) Returns the MIME type of the specified file
11 URL getresource (String path) Returns the URL path for the specified resource (file and directory)
12 InputStream getResourceAsStream (String path) Returns the input stream for the specified resource
13 RequestDispatcher Getrequestdispatcher (String uripath) Returns the RequestDispatcher object for the specified resource
14 Servlet Getservlet (String name) Returns the servlet for the specified name
15 Enumeration Getservlets () Returns an enumeration of all Servlets
16 Enumeration Getservletnames () Returns an enumeration of all servlet names
17 void log (String msg) Writes the specified message to the servlet's log file
18 void log (Exception exception,string msg) Writes the stack trace and error message of the specified exception to the servlet's log file
19 void log (String msg,throwable throwable) Writes the description information of the stack trajectory and the given Throwable exception to the servlet's log file

3.page

The Page object is pointing to the current JSP page itself, a bit like the this pointer in the class

It is an instance of the Java.lang.Object class.

Number Method Description
1 Class GetClass Returns the class of this object
2 int Hashcode () Returns the hash code of this object
3 Boolean equals (Object obj) Determines whether this object is equal to the specified object
4 void copy (Object obj) Copies this object to the specified Object object
5 Object Clone () The object objects can be long
6 String toString () Converts the object object to a String class
7 void Notify () Wake up a waiting thread
8 void Notifyall () Wake up all the waiting threads
9 void Wait (int timeout) Make a thread wait until timeout ends or is awakened
10 void Wait () Make a thread wait until it wakes up
11 void Entermonitor () Lock on Object
12 void Exitmonitor () Lock on Object

"Javaweb" Learning note five 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.