Java Web built-in objects and Java Web built-in objects

Source: Internet
Author: User

Java Web built-in objects and Java Web built-in objects

Jsp built-in objects are a set of objects created by web containers.

The name of the jsp built-in object is a reserved word of jsp.

Jsp built-in objects are objects that can be used directly on the jsp page. You do not need to use new to obtain instances.

Nine built-in jsp objects

1. request

2. response

3. pageContext

4. session

5. application

6. out

7. config

8. page

9. exception

 

The request object is mainly used to process client requests.

The corresponding method provided by the request object can process the parameters of the http request submitted by the client browser.

Common request object Methods

 

String getParameter (String name) obtains Page Submission data based on the page form component name

String [] getParameterValues (String name) obtains the user request data when a page form component corresponds to multiple values.

Void setCharacterEncoding (String charset) specifies the encoding of each request. It is set before getParameter () is called to solve Chinese garbled characters.

 

String getRemoteAddr () returns the IP address of the client that submitted the request.

 

The setCharacterEncoding method can only be used to handle Chinese garbled characters submitted in post mode, and the setCharacterEncoding method must be placed before all getParameter methods, otherwise garbled characters will still appear.

 

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.