Get and post special cases, getpost Special Cases

Source: Internet
Author: User

Get and post special cases, getpost Special Cases

I recently encountered the following problems during my work on file upload:

Submit the form to a url with parameters (such as res. php? Param = aaa). What is the result?


Next we will test the get and post content from several examples. First, let's take a look at the simplest

<span style="font-size:18px;">Submit the url with this parameter in get mode. The result is that the corresponding value is overwritten, and the obtained param is bbb.


What if the parameter in the url is different from the name in the form? See the following test example.

<span style="font-size:18px;">The result shows that the value of param2 is obtained correctly, but the value of param1 is not obtained. It indicates that the parameters of the original url are removed when the request is submitted in get mode.


Next, let's take a look at the post submission process.

First, let's take a look at the situation where the name value is the same

<span style="font-size:18px;">In this case, the output result is aaa in get mode and bbb in post mode, which means that the get and post methods are isolated from each other in this case.


Next, let's take a look at how to get the parameters following the url through post.

<span style="font-size:18px;">In this case, all obtained parameters are null, so the get and post parameters in php are isolated from each other.

Note: When passing the post parameter, you can upload the get parameter together.


However, when you use java to upload files today, you can correctly retrieve all the data, that is, you can use the request in the servlet to obtain the form data of the post or the get data after the url. after all, the methods for obtaining parameters in servlet are the same.






The main difference between get and post methods is that they are used separately.

The submitted parameters are displayed in the get address bar, And the size is limited. Different browsers have different restrictions on the bytes.
The size of post is not limited and cannot be seen in the address bar.

You can use get
Try to use post for other operations

What are the differences between the get and post submission methods?

The upstairs is correct. I 'd like to add more.
That is, in framework technology, you can use the POST method to submit data securely with the configuration file.
However, if GET is used, the transmitted data may be lost.

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.