The difference between get and post methods in a JSP

Source: Internet
Author: User

1, post submission data is implicit, get is passed through the URL (you can look at the address bar of your browser), used to pass some data that do not need to be classified.

2. When using get, the size of the transmitted data is limited (note that the number of parameters is not limited), 2K, and Post does not have this limit.

3, also useful get when in the servlet to use the Doget method, use the post will use the Dopost method. This is the difference that JSP looks at in the Java perspective when dealing with get and post.

4, there is also a point to note oh, through the get way to obtain the parameters of the method and through the post way some differences:

Post:request.getParameter ("");

Get:request. QueryString ("");

< note: When submitting with GET, I also use Request.getparameter () to obtain the passed parameters, although the request.setcharacterencoding ("Utf-8") has been set, but the Chinese parameters are always garbled. But I did not use the latter way to get the parameters, I was directly to post, Chinese display on the normal. >

---------------------------------------------------------------

The following is reproduced from the Internet:

Source: http://topic.csdn.net/t/20010412/23/96108.html

When a form on a page sends request data to a page in a get manner, such as if the data contains unsafe characters, the browser converts it to a 16-character transfer, such as when the space is converted to% 20 o'clock, and WEB   SERVER puts the requested data into a Query_ In the environment variable of string, the QueryString method takes the corresponding value from the environment variable and restores the character converted to 16 (for example,  %20  is restored to a space).

A text box with a   name of username on the form, and a text box with   name password  ,   when the form is submitted, this URL string is generated: http:// www.xxxxx.com/xxxx.asp?username=nnnnn& password=mmmmm
Using   request.querystring ("username")   will get & nbsp String   "nnnnn"
Request.QueryString ("password")   get   "mmmmm"  !

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.