JSP nine large built-in objects and servlet Java objects

Source: Internet
Author: User

  1. Request Object :
    1. GetParameter (String name) gets the data submitted by the form
    2. Getparamegernames () gets all parameter names submitted by the client
    3. GetAttribute (String name) Gets the property value specified by name
    4. Getattributenames get a collection of names for all properties of the request object
    5. GetSession (Boolean Create) gets the HttpSession object
  2. Response Objects : objects are used to respond dynamically to requests from clients, sending data to clients
    1. Getcharacterencoding () returns the character encoding format for the response
    2. Getoutputstream () returns the output stream of the response
    3. Getwriter () Returns an object that can output characters to the client
  3. Session Object : Open the browser from a client and connect to the server to start, to the client close the browser to leave the end of this server, the entire stage is called a session. Session objects can be used to save the user's conversation state.
  4. Exception Object : Used to handle errors and exceptions that occur in JSP pages to help us understand and work with error messages on the page
  5. Page Object : Is the current JSP page book, similar to this in Java
    1. GetClass () Gets the class of the Page object
    2. Hashcode () Gets the hash code of the Page object
    3. Equal (object obj) determines whether the Page object is equal to obj in the parameter
    4. Copy (object obj) copies this page object into the specified object
    5. Clone () Clones the current Page object
  6. PageContext object : Used to manage access to already named objects in a specially visible part of the JSP
  7. Application Object : Realize the sharing of data between users, can hold global variables
  8. Config object : Used to get server initialization configuration parameters
    1. Getservletcontext () Gets the current servlet context
    2. Getinitparameter (String name) Gets the value of the specified initial parameter
    3. Getinitparameternames () Gets the value of all initial parameters
    4. Getservletname () Gets the current servlet name
  9. Out object : Used to output various data to the client
    1. Print ()/println () outputs various types of data
    2. Clearbuffer () Clears the buffer's data and writes the data to the client
    3. Clear () Clears the buffer's data, but does not write data to the client
    4. Close () closes the output stream
The Java object corresponding to the JSP built-in object

JSP built-in objects Java objects in a servlet
Request HttpServletRequest
Response HttpServletResponse
Session HttpSession
exception Throwable
Page This
PageContext PageContext
Application ServletContext
Config ServletConfig
Out JspWriter

JSP nine large built-in objects and servlet Java objects

Related Article

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.