Nine built-in JSP objects

Source: Internet
Author: User

Application:An instance of javax. servlet. servletcontext. This instance represents the web application to which the JSP belongs and can be used for JSP pages or information exchange between servlets. Common methods include:
Getattribute (string attnarne ),
Setattribute (string attnarne, string attvalue)
And getinitpararneter (string paramnarne.

Config:Javax. servlet. servletconfig instance, which represents the configuration information of the JSP. Common methods include getinitpararneter (string paramnarne) and getinitpararneternarnes.
In fact, JSP pages do not need to be configured, so there is no configuration information. Therefore, this object is more effective in servlet.

Exception:Java. Lang. throwable instance, which represents exceptions and errors on other pages. This object can be used only when the iserrorpage attribute of the compiled command page is true. Common methods include getmessageo and rintstacktraceo.

Out:Javax. servlet. jsp. jspwriter instance, which represents the output stream of the JSP page and is used to output content to form an HTML page.

Page:It indicates the page itself, which is usually of little use. That is, this in the servlet. Its type is the generated servlet.

Pagecontext:Javax. servlet. jsp. pagecontext instance. This object represents the context of the JSP page and can be used to access Shared data on the page. Common methods include getservletcontexto and getservletconfigo.

Request:Javax. servlet. http: an instance of httpservletrequest. This object encapsulates a request, and all client request parameters are encapsulated in this object. This is a common object that obtains client request parameters.
This object must be used. Common methods include:
Getpararneter (string paramnarne ),
Getpararnetervalues (string paramname ),
Setattribute (string atttibutename, object attributevalue ),
Getattribute (string attributename) and setcharacterencoding (string env.

Response:The javax. servlet. http. httpservletresponse instance represents the server's response to the client. Usually, this object is rarely used for direct response, and the output response uses the out object, while the response object is often used for redirection. Commonly used methods include sendredirect (J Ava. Lang. string location.

Session:Javax. servlet. http. httpsession instance. This object represents a session. Start from the connection established between the client browser and the site, and start the session until the browser is closed. Common methods include:
Getattribute (string attname), setattribute (string attname, string attvalue), etc.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.