1 GET - Get data from the specified server
1.1 GET method
When using the GET method, the query string (key-value pair) is attached to the URL address and sent to the server together, for example: http://localhost:8080//customer/customer_info?res=json&mt=0&custId=1
1.2 Features
(1) GET requests can be cached
(2) GET request will be saved in the browser's browsing history
(3) The URL requested by GET can be saved as a browser bookmark
(4) GET request has a length limit (cannot exceed 1024 bytes)
(5) GET request is mainly used to obtain data
(6) Low safety
1.3 Call statements in Java programs
String custId= (String)this.getPageUri().get("custId");2 POST - Submit data to the specified server for processing
2.1 POST method
When using the POST method, the query string exists separately in the POST information and is sent to the server together with the HTTP request.
2.2 Features
(1) POST request cannot be cached (2) POST request will not be saved in the browser browsing history (3) The URL of the POST request cannot be saved as the browser bookmark (4) POST request has no length limit (5) Higher security
2.3 Call statements in Java programs
String custId = (String)this.getInParam.get("custId");3. Methods to test POST data
3.1 Test with Postman in Google Browser
After entering the address "http://localhost:8080/customer/customer_info?res=json&mt=1" in Postman, enter the JSON format test statement in "Body-raw", for example:
{ "formData":{ "fd": { "custId":"2000" } }}3.2 Test with HttpRequest in Firefox browser
After entering the address "http://localhost:8080/customer/customer_info?res=json&mt=1" in the URL, enter the JSON format test statement in "Content", for example:
{ "formData":{ "fd": { "custId":"2000" } }}3.3 Write HTML pages for testing
Write simple HTML pages, for example:
<form action="http://localhost:8080/customer/customer_info?res=json&mt=1" method="post"> <input type="text" name="custId" id="custId"> <input type="submit" value="submit"></form>
The above are the two ways to submit Form form data in Java introduced to you by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time!