1. Request object
The request information of the client is encapsulated in the request object, so that the client can understand the customer's requirements and then respond. It is an instance of the httpservletrequest class.
Serial number method description
1 object getattribute (string name) returns the attribute value of the specified attribute
2 enumeration getattributenames () returns the enumeration of all available attribute names
3 string getcharacterencoding () returns the character encoding method
4 int getcontentlength () returns the length of the Request body (in bytes)
5 string getcontenttype () Get the MIME type of the Request body
6. servletinputstream getinputstream () obtains the binary stream of a row in the Request body.
7 string getparameter (string name) returns the parameter value of the specified name parameter.
8 enumeration getparameternames () returns the enumeration of available parameter names
9 string [] getparametervalues (string name) returns an array containing all values of the parameter name
10 string getprotocol () returns the protocol type and version number of the request.
11 string getscheme () returns the scheduler name used for the request, such as HTTP. HTTPS and FTP.
12 string getservername () returns the server host name that receives the request
13 int getserverport () returns the port number used by the server to accept the request.
14 bufferedreader getreader () returns the decoded Request body
15 string getremoteaddr () returns the IP address of the client sending the request.
16 string getremotehost () returns the client host name that sent this request
17 void setattribute (string key, object OBJ) set the attribute Attribute Value
18 string getrealpath (string path) returns the actual path of a virtual path.
2. Response object
The response object contains information about the response to the customer request, but it is rarely used directly in JSP. It is an instance of the httpservletresponse class.
Serial number method description
1 string getcharacterencoding () indicates the character encoding used in the response.
2 servletoutputstream getoutputstream () returns a binary output stream of the response
3 printwriter getwriter () returns an object that can output characters to the client.
4 void setcontentlength (INT Len) set the Response Header Length
5 void setcontenttype (string type) set the MIME type of the response
6 sendredirect (Java. Lang. string location): redirect client requests
3. Session Object
A session object refers to a session between the client and the server, starting from a webapplication that the client connects to the server until the client and the server are disconnected. It is an instance of the httpsession class.
Serial number method description
1 long getcreationtime () returns the session Creation Time
2 Public String GETID () returns the unique ID number set by the JSP Engine during session creation.
3 long getlastaccessedtime () returns the last client request time in this session
4 int getmaxinactiveinterval () returns the interval between two requests this session is canceled (MS)
5 string [] getvaluenames () returns an array containing all the available attributes of this session.
6 void invalidate () cancels the session and makes the session unavailable
7 Boolean isnew () returns a session created by the server, whether the client has been added
8 void removevalue (string name) deletes the attribute specified in the session.
9 void setmaxinactiveinterval () sets the interval between two requests this session is canceled (MS)
4. Out object
An out object is an instance of the jspwriter class and is a common object for outputting content to the client.
Serial number method description
1 void clear () clears the buffer content
2 void clearbuffer () clears the current content of the buffer
3 void flush () clears the stream
4 int getbuffersize () returns the buffer size in bytes. If no buffer is set, the value is 0.
5 Int getremaining () returns how much available the buffer is.
6 Boolean isautoflush () indicates whether to automatically clear or throw an exception when the returned buffer is full.
7 void close () Close the output stream
5. Page Object
The page object points 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.
Serial 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 the object is equal to the specified object.
4 void copy (Object OBJ): copy the object to the specified object.
5. Clone () this object.
6 string tostring () converts the object to a string object.
7 void y () Wake up a waiting thread
8 void yyall () Wake up all waiting threads
9 void wait (INT timeout) causes a thread to wait until the timeout ends or is awakened
10 void wait () enables a thread to wait until it is awakened
11 void entermonitor () locks the object
12 Void exitmonitor () locks the object
6. Application Object
The Application Object shares data between users and stores global variables. It starts from the start of the server until the server is closed. During this period, this object will always exist. In this way, the object can be connected between users or between users, you can perform operations on the same attribute of this object. Operations on this object attribute anywhere will affect access by other users. The startup and shutdown of the server determine the life of the Application object. It is an instance of the servletcontext class.
Serial number method description
1 object getattribute (string name) returns the attribute value to the name
2 enumeration getattributenames () returns the enumeration of all available attribute names
3 void setattribute (string name, object OBJ)
4 void removeattribute (string name) delete a property and its attribute values
5 string getserverinfo () returns the JSP (servlet) engine name and version number.
6 string getrealpath (string path) returns the actual path of a virtual path.
7 servletcontext getcontext (string uripath) returns the Application Object of the specified webapplication.
8 int getmajorversion () returns the maximum servlet API version supported by the server.
9 int getminorversion () returns the maximum servlet API version 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 of the specified resource (file and directory)
12 inputstream getresourceasstream (string path) returns the input stream of the specified resource
13 requestdispatcher getrequestdispatcher (string uripath) returns the requestdispatcher object of the specified resource
14 servlet getservlet (string name) returns the servlet with the specified name
15 enumeration getservlets () returns the enumeration of all servlets
16 enumeration getservletnames () returns the enumeration of all servlet names
17 void log (string MSG) writes the specified message to the servlet Log File
18 void log (exception, string MSG) writes the stack track and error message of the specified exception to the servlet Log File
19 void log (string MSG, throwable) writes stack tracing and throwable exception descriptions to the servlet log file.
7. Exception object
An exception object is an exception object. When an exception occurs during a page running, this object is generated. To apply this object to a JSP page, you must set iserrorpage to true; otherwise, compilation fails. It is actually a java. Lang. throwable object.
Serial number method description
1 string getmessage () returns a message describing an exception
2 string tostring () returns a brief description message about the exception.
3 void printstacktrace () displays exceptions and stack traces
4 throwable fillinstacktrace () rewrite the execution stack track of an exception
8. pagecontext object
The pagecontext object provides access to all the objects and namespaces on the JSP page, that is, it can access the session on this page, or take a property value of the application on this page, it is equivalent to the aggregator of all functions on the page. Its Class Name is also called pagecontext.
Serial number method description
1 jspwriter getout () returns the jspwriter stream (out) in use in the current client response)
2 httpsession getsession () returns the httpsession object (session) on the current page)
3 object getpage () returns the object (PAGE) of the current page)
4 servletrequest getrequest () returns the servletrequest object (request) of the current page)
5 servletresponse getresponse () returns the servletresponse object (response) of the current page)
6 exception getexception () returns the exception object (exception) of the current page)
7 servletconfig getservletconfig () returns the servletconfig object (config) of the current page)
8 servletcontext getservletcontext () returns the servletcontext object (Application) of the current page)
9 void setattribute (string name, object attribute) set attributes and attribute values
10 void setattribute (string name, object OBJ, int scope) set attributes and attribute values within the specified range
11 public object getattribute (string name): Get the attribute value
12 object getattribute (string name, int scope) takes the attribute value within the specified range
13. Search for a public object findattribute (string name) Attribute and return the starting attribute value or null.
14 void removeattribute (string name) delete an attribute
15 void removeattribute (string name, int scope) deletes an attribute within a specified range.
16 int getattributescope (string name) returns the range of an attribute.
17 enumeration getattributenamesinscope (INT scope) return available attribute name enumeration within the specified range
18 void release () releases resources occupied by pagecontext
19 void forward (string relativeurlpath) causes the current page to be re-exported to another page
20 void include (string relativeurlpath) contains another file at the current position
9. config object
The Config object is used by the JSP Engine to transmit information to a servlet during initialization. This information includes the parameters used during servlet initialization (consisting of attribute names and attribute values) and server-related information (by passing a servletcontext object)
Serial number method description
1 servletcontext getservletcontext () returns the servletcontext object containing server-related information
2 string getinitparameter (string name) returns the value of the initialization parameter.
3 enumeration getinitparameternames () returns the enumeration of all parameters required for servlet initialization.