Differences between doget and dopost

Source: Internet
Author: User

Doget: Process GET requests

Dopost: Process post requests

When sending a client request, call the service method and pass a request and response object. Servlet first checks whether the request is a get operation or a post operation. Then it calls the following method: doget or dopost. If the request is get, the doget method is called. If the request is Post, The dopost method is called. Both doget and dopost accept requests (httpservletrequest) and responses (httpservletresponse ).

1. Size

Get has only one stream. After the parameter is appended to the URL, the address line displays the information to be transmitted. The size of the get parameter is strictly limited to strings and the size is limited to kb. The post parameter is transmitted through another stream, not through the URL, so it can be large or pass binary data, such as file upload.

2. Address Bar

Parameters submitted by get through URL are displayed in the address bar, which may cause problems in system security. parameters submitted by post are not displayed in the address bar. In this way, post can improve the security performance of get and avoid data leakage.

3. Execution

When the method in the form box is get, execute the doget method. If you use get to submit, you must use the doget () method on the server side to receive it. When the method in the form box is post, to execute the dopost method, you must use the dopost () method on the server side to receive the request by using the POST method.

4. encoding conversion

In the request, the encoding conversion is required for each of the content obtained by the get method, while the POST method only needs to set the request. setcharacterencoding ("UTF-8") is fine, and do not encode and convert each data from the request.

Differences between doget and dopost

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.