Today mainly learns the built-in object of JSP. What is an object? In object-oriented programming, the object refers to a variable consisting of an operation and data as a complete entity.
Objects are based on a particular model, and the service used in the object uses the object to access the object by a set of methods or related functions, and the client can call these methods to perform a mode.
The JSP's built-in object has the following: Request, Response, Out, Session, PageContext, Application, Config, Page.
◆ Request [Request] Object
The Request object is used to accept all information from all requests sent from the browser to your server.
Contact with Request is the HTTPSERVLETREQUEST class. The Request parameter can be obtained by getParameter method, and the type of Request can be obtained by get, post, head, etc., and the introduced HTTP header can be obtained by cookies, Referer et al.
◆ Response [Response] object
The Response object is used to send data to the client browser, and the user can use the object to send the server's data to the user-end browser.
Contact with Response is the HTTPSERVLETRESPONSE class.
◆ OUT object
OUT object is used to output data to the client.
◆ Session [Work] Object
The Session object is used to save the object of each user information to facilitate tracking of the user's operation.
Contact the session is the HttpSession class, and the session is automatically created.
Note: The session objects corresponding to different users are generally different.
◆ PageContext object
PageContext objects are used to manage access to objects that have been named in the special visible part of JSP. A new class in JSP.
◆ Application [Application] Object
Application objects are used to save information in multiple programs. Used to share information between all users, and can maintain data during the Web application running.
Contact Application is the servletContext class, by using getServletConfig (). GetContext () method. Once an Application object is created, the object will remain until the server is turned off.
Note: Each user's Application object is the same, and each user uses the same Application object.
◆ Config object
The Config object is used to configure the handle of the processed JSP program, and only legal in the JSP page range.
It is an object of a servletconfig class.
◆ PAGE object
The Page object is only used to save the language of the script is not the time of Java, which is not very practical in Java.
I learned here today, learn the Request object in JSP built-in object tomorrow.