Java Learning-built-in objects

Source: Internet
Author: User

What is a built-in object?

is a set of objects created by the Web container and does not need to be built-in objects that can be used directly with the New keyword.

The nine main built-in objects for JSPs:

Commonly used are: Out object, Request object, Response object, Session object, Application object

Infrequently used are: Page object, PageContext object, exception object, config object.

Out object: Is an instance of the JspWriter class that is responsible for the common objects that output content to the client. Common methods are:

void println () prints a string to the client.

void Clear () clears the buffer contents and throws an exception if used after flush.

void Clearbuffer () clears the contents of the buffer, and the call does not throw an exception after flush.

void Flush () outputs the buffer contents to the client.

int GetBufferSize () returns the size of the number of buffer bytes, or 0 if the buffer is not set.

int getremaining () returns how much of the buffer is left to use.

Boolean Isautoflush () returns whether the buffer is full or empty or throws an exception.

void Close () closes the output stream.

Request object: The user encapsulates the requested information submitted by the client. is an instance of the HttpServletRequest class. Common methods are:

String GetParameter (string name); Returns the parameter value of the parameter specified by name. Read request parameters

String[] Getparametervalues (String name); Returns the data that contains the name. such as multi-box, etc.

void SetAttribute (String,object); Storing properties in a request

Object GetAttribute (String name); Returns the property value of the specified property

String getContentType (); Gets the MIME type of the request body

String Getprotocol (); Returns the protocol type and version number of the request

String getservername (); Returns the host name of the server that accepts the request

void Setcharacterencoding ("Write code here"); Set the encoding method to accept the request//solve the problem of accepting garbled, must use post submission

Java Learning-built-in objects

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.