JSP stealth objects are a group of instances loaded by web containers. It is an object that can be used directly on a JSP page. It can be divided into four categories:
Input and Output objects: control the input and output (request, reponse, out) of the page)
Scope communication object: Retrieves servlet-related information (Session, application, pagecontext) on the JSP page)
Servlet object: Provides page Environment Information (page, config)
Error object: handling errors on the page (exception)
1. Request object
The request implicit object indicates the client request, including all request information. The methods include:
String getparameter (string name): obtains the data submitted by the request Page Based on the page form component name.
String getparametervalues (string name): obtains the user request data (such as the check box) when a form component corresponds to multiple values in a page request)
2. Response object
The response implicit object processes the JSP-generated response and then sends the response result to the client;
Methods:
Void setcontenttype (string name): Set the type and character encoding of the content generated as a response.
Void sendredirect (string name): sends a response to the browser, indicating that it responds to the request to another URL (redirected to another URL, will lose data after the jump, no longer execute the sendredirect method belowCode)
3. Out object
The out object indicates the output stream. The output stream object is sent to the client as a request response. Common methods include print (), println (), and write ().
4. pagecontext object
The pagecontext object allows you to access all the implicit objects defined in the scope on the current page.
The most common method:
Void setattribute (string name, object Value): stores the value of an object in pagecontext by name/value.
Void getattribute (string name): obtains the value of the object stored in pagecontext Based on the name.
5. Session Object
The Session Object indicates the user's session status. This mechanism can be used to easily identify each user and store and track sessions. Same method!
6. Application
The Application Object acts on the entire application.ProgramThe client port used can coexist with this object. The object exists from the server until the server is closed!
7. Page Object
The Page Object provides access to all objects defined on the page. The Page Object indicates the page itself, which is an instance of the Java. Lang. Object Class.
8. config object
Config object stores some servlet initialization information. The Config object is Java. An instance of the servlet. servletconfig interface. The servletconfig interface provides methods to verify servlet initialization parameters. The Config object indicates the configuration of servlet initialization data on the JSP page!
9. Exception object
The printstacktrace () method is used to display abnormal stack traces.