Home  >  Article  >  Java  >  What is the difference between get and post in java

What is the difference between get and post in java

王林
王林Original
2020-05-17 14:47:194537browse

What is the difference between get and post in java

The differences are as follows:

1. Get is to obtain data from the server, and post is to transmit data to the server.

The get request returns any information indicated by the request-URI. Post requests are used to send email, news, or send forms that can be filled out by interactive users. This is the only request that requires sending the body in the request. When using a Post request, you need to indicate the length of the body in the Content-Length field of the message header.

(Video tutorial recommendation: java video)

2. Get adds the parameter data queue to the URL pointed to by the ACTION attribute of the submitted form. The value and form Each field corresponds one to one and can be seen in the URL. Post uses the HTTP post mechanism to place each field in the form and its content in the HTML HEADER and transmit it to the URL address pointed to by the ACTION attribute. The user cannot see this process.

3. For the get method, the server uses Request.QueryString to obtain the value of the variable. For the post method, the server uses Request.Form to obtain the submitted data.

4. The amount of data transferred by get is small and cannot be larger than 2KB. The amount of data sent by post is relatively large and is generally unrestricted by default. But in theory, the maximum amount is 80KB in IIS4 and 100KB in IIS5. Those using IIS filters only accept get parameters, so generally large search engines use the get method.

5. The security of get is very low, while the security of post is relatively high. If the data is Chinese data and non-sensitive data, then use get; if the data entered by the user is not Chinese characters and contains sensitive data, then it is better to use post.

Recommended tutorial: Getting started with java development

The above is the detailed content of What is the difference between get and post in java. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn