The JSP total of nine predefined objects such

The JSP predefined total of nine such objects, namely: request, response, session, application, out, pagecontext, config, page, exception
1、request对象

javax.servlet.httpServletRequest request object is an object type. The object represents a client request information, mainly for receiving data transmitted to the server via the HTTP protocol. (Including header information, system information, and a request requesting mode parameters, etc.). Scope request once the request object.

2、response对象

response represents the response to the client, mainly the JSP container treated objects back to the client. The response object also has a scope, it is only valid within the JSP page.

3、session对象

session object is created automatically related objects requested by the user by the server. Server generates a session object for each user, for storing information of the user, the tracking operation state of the user. Map session using internal object classes to store data, the data stored in the format "Key / value". value session object may make the complex object types, not just a string type.

4、application对象

application information objects can be stored in the server until the server is shut down, otherwise the application objects stored information will be valid throughout the application. Compared with the session objects, application objects longer life cycle, similar to the system of "global variables."

5、out 对象

out object is used to output information in the Web browser, and manage the output buffer on the application server. When the object using the output data out, the operation may be made to the data buffer, timely removal of residual data in the buffer, so that the space for other output buffer. After the completion of data output, to close the output stream.

6、pageContext 对象

The role of pageContext object is to obtain any range of parameters, you can get out JSP page through it, request, reponse, session, application and other objects. pageContext objects are created and initialized by the container to complete, can be used directly pageContext object in JSP pages.

7、config 对象

The main role of config object is to obtain configuration information for the server. By pageConext object getServletConfig () method gets a config object. When a Servlet initialization, certain information transmitted to the container the Servlet using the config object. Application developers can program in the environment Servlet and JSP pages provide initialization parameters in the web.xml file.

8、page 对象

object represents the JSP page itself, only in the JSP page is legitimate. page hidden object contains the current Servlet interface reference variable in nature, similar to the this pointer in Java programming.

9、exception 对象

The role of the exception object is to display exception information, containing only can be used isErrorPage = "true" page, use the object in general will not compile JSP page JSP file. excepation object and all the objects, like Java, has inherited the structure provided by the system. Almost all the exception object is defined exceptions. In Java programs, you can use try / catch keyword to handle exceptional conditions; if not caught exception occurs in a JSP page, it will generate exception object, and the object is transferred to the exception error page set in the page directive and then processing the corresponding exception object error page.

Guess you like

Origin www.cnblogs.com/rzbwyj/p/11124358.html