Method usage in request and response

Disclaimer: The materials used in this column are written by VIP students of Kaige Academy. Students have the right to remain anonymous and have the right to final interpretation of the article. Kaige Academy aims to promote VIP students to learn from each other based on public notes.

In a web project, if the content is updated in an external tool, it will not be automatically deployed to the server in eclipse. If it is modified in eclipse, it will be automatically deployed.

There are two cases for obtaining the value in the getparaameter(String) method:
1. If there is no name you wrote in the form, return null
2. If an empty string is filled in the form, return a null character

image

The results obtained:

image

We can get all the names of the request header through the Enumeration<E> elevator

image

Garbled code processing: 1. Set the encoding format on the page, so that the browser will convert the format for you when submitting data.
2. When receiving data on the server, you need to call the transcoding method, and then get the form data

setCharacterEncoding(String) Set the character set encoding format
If we do not set the encoding format on the page and do not use this method to call the transcoding on the server, the form we submit will appear garbled.

image

image

After setting, there will be no garbled characters

image

Methods in HttpServletResponse

image

image

Some method operations

image

image

Here you need to tell the browser the encoding format of the content you are responding to

image

image

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326671593&siteId=291194637
Recommended