1. Receive the form submission data by means of parameter
Retrieve data forms four ways: can only receive the post submission of data
2. To receive the form data by FormCollection
Retrieve data forms four ways: can only receive the post submission of data
3. By Request. The Form/" name attribute value "to obtain the Form data
Retrieve data forms four ways: you can receive the post and get submitted data
4. EntityClass entity class receive data
Second, the attribute of the form form the action and method
The attribute value description
The action URL rules when submitting the form where to send the form data
Method get/post rules used to send the form to the data of the HTTP method, (submission form)
URL possible values:
Absolute URL - pointing to other sites (such as SRC="https://bbs.csdn.net/topics/www.baidu.com")
Relative URL - pointing at the site files (such as SRC="https://bbs.csdn.net/Form00/getData")
Method the value of the get/post
Get submitted directly exposed to the URL parameters,
(W3School given on difference:)
Compared with the POST, GET more simple and faster, and in most cases can be, however, in the following cases, please use the POST request:
1. Unable to use the cache file (update the file on the server or database)
2. Huge amounts of data can be sent to the server (POST there is no limit to the amount of data)
3. Send contains unknown character of user input, POST than GET more stable and more reliable
Get/post difference:
1. The GET method is used to GET the data to the server, and PSOT is used to transfer modify data on the server,
2. GET the data in a form is added to the action points to the URL, and between the use of "?"
Between each variable and the use of "& amp;" The connection; PSOT is the form of the data in the form of data volume (FormData),
According to the keys on the way, is passed to the points of action
3. It is not safe to GET, because in the process of transmission, data is placed on the requested url so that users can directly see the data submitted on the browser,
POST all the operations are not visible to the user, the data in data volume (FormData)
4. The GET method to the URL to add data, the length of the URL is restricted maximum length is 2048 characters (URL), POST submission unlimited
https://www.w3school.com.cn/tags/html_ref_httpmethods.asp
5. GET to the default submission form form
6. The GET method to GET the data after the refresh will not have a negative impact, because it is just to GET the data,
POST data will be resubmitted may have adverse consequences (browser should inform the user data will be resubmitted)
7. The data type of restrictions: GET allow only ASCII characters, the POST is unrestricted (if submitted binary data (such as picture), you need to use the POST method)
Three, myform. Method="get";//submission
Myform. Action="/Form/GetData";//submit address
1) can receive data through the parameter Form (2) can receive data through FormCollection 3. The Request Form to receive the Form data
Myform. Action="/Form/getDataByFormCollection";
Myform. Action="/Form/getDataByRequest";
Myform. Action="/Form/getDataByEntityClass";//url=="/controller/method name"
Four, manual submission form data
Myform. Method="post";//submission
Myform. Action="/Form/GetData";//submit address
1) can receive data through the parameter Form (2) can receive data through FormCollection 3. The Request Form to receive the Form data
Myform. Action="/Form/getDataByFormCollection";
Myform. Action="/Form/getDataByRequest";