liveBook · Manning

POST

As explained in Spring Start Here, Second Edition

POST is the HTTP method for submitting data to a resource for processing, often resulting in a state change.

POST is an HTTP method for sending new data to a server to add or process. Unlike GET, which retrieves data, POST can add a product to a list. section 8.2

Adding a product

A form sends a product’s name and price to /products using POST. A Spring controller receives the values, creates a Product, and asks a service to add it. The controller then returns the updated product list to the view. GET and POST can use the same path because the HTTP method distinguishes their actions. section 8.2

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 with GET, PUT, PATCH, and DELETE to see how HTTP methods express different request actions. section 8.2

How Spring Start Here, Second Edition covers it

How deep it goes
Demonstrates form submission, controller binding, and service updates, while noting that the in-memory list is a simplification.
Examples
Uses a product form with name and price fields to add an item to a displayed list.
What you can do after
Apply POST with Spring MVC to receive form values, update a service, and return a view.
How it connects
Distinguishes POST from GET, PUT, PATCH, and DELETE by the action each method expresses.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring Start Here, Second Edition. The section links point to the parts of the book it draws on.