The nine built-in objects in JSP are backed up and used for the written examination.
Request, Response, pageContext, session, Application, Out, Config, Page, Exception 1. the request information of the request object client is encapsulated in the request object, which can be used to 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 length of the Request body (in bytes) 5 String getContentType () to obtain the MIME type of the Request body 6 ServletInputStream getInputStream () get the binary stream 7 String getParameter (String name) of a row in the Request body. Return the parameter value of the parameter specified by name. 8 Enumeration getParameterNames (). Return the enumerated 9 String [] getParameterValues of the available parameter name. (String name) returns the 10 String getProtocol () of the array containing all values of the parameter name. The protocol type and version 11 String getScheme () used in the request are returned, for example: http. 12 String getServerName (), such as https and ftp, returns the Host Name of the server that receives the request 13 int getServerPort (), and returns the port number 14 BufferedReader getReader () used by the server to accept the request () returns the decoded Request body 15 String getRemoteAddr (), returns the Client IP address 16 String getRemoteHost (), returns the client host name 17 void setAttribute (String key, object obj) sets the attribute property value 18 String getRealPath (String path) returns the actual path of a virtual path. 2. 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. The serial number method specifies the character encoding 2 ServletOutputStream getOutputStream () used to return a response. A binary output stream 3 PrintWriter getWriter () returns an object 4 void setContentLength (int len) that can output characters to the client. Sets the Response Header Length 5 void setContentType (String type) and sets the response MIME type 6 sendRedirect (java. lang. string location) redirect client requests 3. the session object refers to a session between the client and the server. The session object starts when the client connects to a WebApplication on the server until the client is disconnected from the server. It is an instance of the HttpSession class. the serial number method indicates that 1 long getCreationTime () returns the SESSION creation time 2 public String getId () returns the unique ID 3 long getLastAccessedTime () set by the JSP Engine during SESSION Creation () returns the client's last request time in this SESSION 4 int getMaxInactiveInterval () returns the interval between two requests this SESSION was canceled (MS) 5 String [] getValueNames () returns an array of 6 void invalidate () containing all the available attributes of this SESSION to cancel the SESSION. If the SESSION is unavailable, 7 boolean isNew () is returned to a SESSION created by the server, whether the client has added 8 void removeValue (String name) Delete the attribute 9 void setMaxInactiveInterval () specified in the SESSION sets the interval between two requests this SESSION is canceled (MS) 4. the out object is an instance of the JspWriter class. It is a common method for outputting content to the client. It indicates that 1 void clear () clears the content of the buffer 2 void clearBuffer () clear the current content of the buffer 3 void flush () Clear the stream 4 int getBufferSize () returns the buffer size in bytes. If no buffer is set, it is 0 5 int getRemaining () the number of available 6 boolean isAutoFlush () returned buffer is full, whether to automatically clear or throw an exception 7 void close () close the output stream 5. the page object points to the current JSP page itself, a bit like the this pointer in the class, which is java. Lang. object class instance sequence number method description 1 class getClass returns this Object class 2 int hashCode () returns this Object's hash code 3 boolean equals (Object obj) determine whether the Object is equal to the specified Object. 4 void copy (Object obj): copy the Object to the specified Object. 5 Object clone () clone this Object 6 String toString () convert this Object to a String Object 7 void every Y () Wake up a waiting thread 8 void every yall () wake up all waiting threads 9 void wait (int timeout) so that a thread is waiting until the timeout ends or is awakened 10 void wait () so that a thread is waiting until it is awakened 11 void enterMonitor () locks the Object 12 void exitMonitor () locks the Object 6. The application Object implements data sharing 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. The serial number method indicates that 1 Object getAttribute (String name) is returned to the named attribute value 2 Enumeration getAttributeNames (). Enumeration of all available attribute names is returned. 3 void setAttribute (String name, Object obj) set attribute value 4 void removeAttribute (String name) delete a property and its attribute value 5 String getServerInfo () return JSP (SERVLET) engine name and version 6 String getRealPath (String path) returns the actual path of a virtual path 7 ServletContext getContext (String uripath). returns the application Object 8 int getMajorVersion () of the specified WebApplication. The maximum version of the server-supported Servlet API 9 int getMinorVersion () returns the maximum version of the server-supported Servlet API 10 String getMimeType (String file) return the MIME type of the specified file 11 URL getResource (String path). Return the URL path 12 InputStream getResourceAsStream (String path) of the specified resource (file and directory) returns the input stream 13 RequestDispatcher getRequestDispatcher (String uripath) of the specified resource. returns the RequestDispatcher object 14 Servlet getServlet (String name). returns the Servlet 15 Enumeration getServlets () with the specified name. Enumeration with Servlet 16 Enumeration getServletNames () returns 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 Exception, String msg) write the stack track and error message of the specified exception to the log file 19 void log (String msg, Throwable throwable) of the Servlet) write stack tracing and Throwable exception descriptions to the Servlet log file. the exception object is an exception object. This object is generated when an exception occurs during the running of a page. To apply this object to a JSP page, you must set isErrorPage to true; otherwise, compilation fails. He is actually a java. lang. throwable Object Sequence Number Method description 1 String getMessage () returns a message describing an exception 2 String toString () returns a brief description of the exception message 3 void printStackTrace () display exceptions and stack tracing 4 Throwable FillInStackTrace () rewrite execution stack tracing 8. the pageContext object provides access to all objects and namespaces on the JSP page, that is, it can access the SESSION on this page, you can also take a property value of the application where the page is located. It is equivalent to the aggregator of all functions on the page. Its Class Name is also called pageContext. The serial number method indicates that 1 JspWriter getOut () returns the JspWriter stream (out) used by the current client in response to the current client. 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) 5 ServletResponse getResponse () of the current page () returns the current page's ServletResponse object (response) 6 Exception getException () returns the Exception object (exception) of the current page 7 ServletConfig getServletConfig () returns the current page's ServletConfig object (config) 8 ServletContext getServletContext () returns the current page's ServletContext Object (application) 9 void setAttribute (String name, Object attribute) set attributes and attribute values 10 void setAttribute (String name, Object obj, int scope) set the attribute and attribute value within the specified range 11 public Object getAttribute (String name) Get the attribute value 12 Object getAttribute (String name, int scope) get the attribute value 13 public Object findAttribute (String name) within the specified range to find an attribute, return the starting attribute value or NULL 14 void removeAttribute (String name) delete an attribute 15 void removeAttribute (String name, int scope) delete an attribute 16 int getAttributeScope (String name) within a specified range returns the range of a property 17 Enumeration getAttributeNamesInScope (int scope) returns the enumerated 18 void release () Attribute names available within the specified range to release 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) to include another file 9 at the current position. the config object is used by the JSP Engine to transmit information to a Servlet during Servlet initialization. This information includes the parameters used during Servlet initialization (consisting of attribute names and attribute values) and server-related information (passing a ServletContext object). The serial number method indicates 1 ServletContext getServletContext (). The ServletContext object 2 String getInitParameter (String name) containing server-related information is returned) returns the value of the initialization parameter 3 Enumeration getInitParameterNames (). returns the Enumeration of all parameters required for Servlet initialization.