js| variables | Tutorial JSP expressions and code in Scriptlets provide 8 automatically defined variables, sometimes called implicit objects (intrinsic objects). They are: request,response,out,session,application,config,pagecontext, and page. Let's take a look at them in detail.
Request
Associated with request is the HttpServletRequest class, which allows you to get the parameters of the request (through the GetParameter method), the type of request (Get,post,head, and so on), And the introduction of HTTP headers (cookies,referer, etc.). In strict terms, the request is a subclass of class ServletRequest rather than a httpservletrequest class, in fact, if the request protocol is not HTTP, it will hardly work.
Response
The response of the client is connected to the HttpServletResponse. Note that because the output stream is buffered, you can set the HTTP status code and the response header, although it is not allowed to be sent to the client in standard Servlets.
Out
This uses the PrintWriter class to send output to the client. However, in order for the response object to work, you can use a buffered version of the Printwrite class JspWriter. You can define the size of the buffer yourself by using the Properties page directive of the session. You can even turn off buffering after using the buffer property. Also note that out is only used in scriptlets, because the JSP expression is automatically placed in the output stream, so there is very little need for explicit declaration out.
Session
Apply the HttpSession class that is associated with the request. Because the session is created automatically, this variable can still be bound even if there is no one introduced. One exception is that if you close the session with Page directive and then try to use session, it will cause an error (when the JSP page is converted to the servlet).
Application
Use the Serveletcontext class by using Getservletconfig (). GetContext () obtained.
Config
is an object of a ServletConfig class.
PageContext
This is a new class PageContext in the JSP that is used to refine the characteristics of a particular server, such as improving the efficiency of jspwriters execution. If you access this class instead of directly, your code will still run in the "rules" of the Jsp/servlet engine br>
Page
is not very useful in Java, it is only used to save time when the script's language is not java.