liveBook · Manning

Web form

As explained in Spring Start Here, Second Edition

An HTML form is a browser interface element that collects user input and submits it to a server.

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

How Spring Start Here, Second Edition covers it

How deep it goes
Demonstrates form fields, submission, parameter binding, and product creation; notes that other HTTP methods require client-side code.
Examples
Uses a product form with name and price fields that submits to /products and adds the product to a list.
What you can do after
Apply it via Spring MVC to submit a product name and price to a POST handler and display the updated list.
How it connects
Links HTML forms to HTTP GET and POST, Spring MVC controllers, request parameters, and model binding.

Also explained in

Compare how 16 books explain web form →

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.