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 Request object is used to accept all information from the request 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 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 session object is used to save objects of each user information to facilitate tracking of the user's operational state. 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 object is used to manage access to objects that have been named in the special visible section of JSP. A new class in JSP. ◆ Application [Application] Object Application object is 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 config objects are used to configure handles that process the JSP program, and only legal in the JSP page range. It is an object of a servletconfig class. ◆ Page object Page object is only used to save the language in the script is not the time of Java, which is not very practical in Java.
1. The main method of the Request object: ☉ GetAttribute (String Name) Returns the Name property value. ☉ GetaTtributeNames () Returns all attribute names of the Request object. ☉ getCookies () Returns the Cookies object of the client. ☉ GetHeader (String Name) Gets the file header information defined by the HTTP protocol. ☉ GetHeaders (String Name) Returns all values of the Request Header of the specified name. ☉ getMethod () gets the client to transmit data to the server. ☉ getParameter (String Name) Get the parameter value of the client to the server. ☉ getParameterNames () gets the name of all parameters of the client to the server. ☉ getParameterValue (String Name) Get all values of the specified parameter. ☉ getProtocol () Gets the name of the protocol that the client is transferred to the server. ☉ getQueryString () get the query string. ☉ getRequesturi () Get the client address that issues a request string. ☉ getRemoteAddr () Get the IP address of the client. ☉ getRemotehost () Get the name of the client. ☉ GetServerName () Get the name of the server. ☉ GetServletPath () Get the file path of the script file requested by the client. ☉ GetServerPort () Get the port number of the server. ☉ setttribute (String name, java.lang.Object objt) Sets the value of the request parameter named Name, which is specified by the OBJT of the java.lang.object type.
Example: [Request.jsp]
Example: Timed refresh [refresh.jsp] <% @ page contentty = "text / html; charSet = GB2312"%> <% @ page import = "java.util.date"%>
☉ GetServletInfo () Returns the current version of the servlet compiler.