The two most common HTTP methods in the HTTP method are GET and POST.
One what is HTTP
The Hypertext Transfer Protocol (HTTP) is designed to ensure communication between the client and the server. The way HTTP works is between the client and the server
request-response protocol. a Web browser might be a client, and a network application on a computer might be a server-side.
The client (browser) submits an HTTP request to the server, and the server returns a response to the client. The response contains status information about the request and may
The content that was requested.
Two HTTP request methods: When requesting-response between the client and the server, the two most commonly used methods are GET and POST.
(1) GET-requests data from the specified resource.
(2) POST-submits the data to be processed to the specified resource.
Get and post difference tables:
Two forms (counted as the client) commit the code:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">We don't see any difference here on the client side, but there is a clear difference (and the most direct difference) between the form submission to the server end:The address bar of the Get submission method:
file:///C:/Users/Administrator/Desktop/the page that received the data
Face. Aspxuser=abc&psw=123&repsw=123&sex=man&technology=java&country=china
The address bar of the post submission method:
file:///C:/Users/Administrator/Desktop/the page on which the data was received. aspx
Some of the differences can be seen from the above:
(1) The Get submission information is displayed in the Address bar, and post submissions are not displayed in the Address bar.
(2) Get commit is unsafe for sensitive information data; Post submission is safe for sensitive information;
(3) Get commits do not work for big data because the address bar stores information that is limited, and post can submit large volumes of data.
(4) The Get commit encapsulates the information into the request line of the request information, and the post submission encapsulates the information in the request body;
Three differences on the server side
If the Chinese is submitted to the Tomcat server, the server will be decoded with iso8859-1 by default, garbled, and encoded by iso8859-1
Code, and then using the specified Chinese table decoding, can be;
However, there is another workaround for the Chinese submission of the post submission method, which is to use the server-side object Request object directly
The Setcharacterencoding method directly sets the specified Chinese code table to parse the Chinese data, and this method only makes the data in the request
Decoding.
The data of Form can be obtained by get or POST method, the main difference is the following aspects:
(1) Get mode:
URL changes, displaying the Name/value value of the HTML Form parameter in the URL.
Only for HTML Form with a small number of parameters, because the URL length has a character limit and cannot be infinitely long.
Information that involves security, such as a user password, cannot be used because it is displayed on a URL and is not secure.
(2) Post mode:
The URL does not change, and the HTML Form data is not displayed in the URL.
The information submitted by Form does not have a length limit.
Security-related information, such as user passwords, should be post-based.
Five summary
three ways to interact with the client and server side:
(1) Address field enter the URL address; get
(2) Hyperlinks; get
(3) Form; get and post
pros and cons of Get and post:
(1) Get is used to obtain data from the server, and post is used to pass data to the server.
(2) Get adds the data in the form as Variable=value, followed by the URL to which the action points, and both use "?". Connection, while
Use the "&" connection between the variables, post is the data in the form in the data body, according to the variables and values corresponding to the way, passed to the action
The URL that you are pointing to.
(3) Get is not secure, because in the transfer process, the data is placed in the requested URL, and now many of the existing servers, proxy servers or
The user agent logs the request URL to a log file and places it somewhere so that some privacy information may be visible to third parties. Other
, users can see the submitted data directly in the browser, and some system internal messages will be displayed in front of the user. All operations on the post are
are not visible to the family.
(4) The amount of data transferred by get is small, mainly because of the URL length limit, and post can transfer a large amount of data, so the upload file can only use
Post (and of course there is one reason that will be mentioned later).
(5) Get restricts the value of the data set for form forms to ASCII characters, while Post supports the entire ISO10646 character set. The default is to use Iso-8859-1
Coding.
(6) Get is the default method for form.
(7) Get is executed more efficiently than post.
(8) For Get mode, the server side uses Request.QueryString to get the value of the variable, for the Post method, the server side uses Request.Form to obtain
The submitted data.
There is no server-side at this time, so it is difficult to provide more effective data argumentation. Learned the server side, in a more detailed understanding.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
HTML Learning 11:http Method