An HTML form collects input in the browser and submits it to a server. In a product-list app, it sends a product name and price to add to the list. section 8.2
Adding a product
A form at /products uses POST and provides text and number inputs named name and price. A Spring MVC controller receives those values, creates a product, adds it to the list, and returns the updated product view. Browser forms directly use GET or POST; other methods require a client language such as JavaScript. section 8.2 section 8.4
Table 8.2 Basic HTTP methods you’ll often encounter in web apps
|
HTTP method
|
Description
|
|
GET
|
The client’s request only retrieves data.
|
|
POST
|
The client’s request sends new data to be added by the
server.
|
|
PUT
|
The client’s request changes a data record on the server
side.
|
|
PATCH
|
The client’s request partially changes a data record on
the server side.
|
|
DELETE
|
The client’s request deletes data on the server side.
|
Compare POST, used to add data, with other common HTTP methods. section 8.2















