@PostMapping: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
=Internal=
=Internal=


* [[Spring_MVC_Concepts#Controller|Spring MVC Concepts]]
* [[Spring MVC Concepts#.40PostMapping|Spring MVC Concepts]]


=Overview=
=Overview=


Designates a controller handler method to handle POST requests. The content of the posted HTML form is presented to the method as a domain model data object: when the form is submitted, the fields in the form are bound to properties of the domain model object instance. In the example below, the form is used to build a taco composition:
Designates a controller handler method to handle POST requests. The annotation may also contain a sub-path relative to the class-level base path, usually configured with [[@RequestMapping]].
 
The content of the posted HTML form is presented to the method as a domain model data object: when the form is submitted, the fields in the form are bound to properties of the domain model object instance. In the example below, the form is used to build a taco composition:


<syntaxhighlight lang='java'>
<syntaxhighlight lang='java'>

Revision as of 04:23, 12 October 2018

Internal

Overview

Designates a controller handler method to handle POST requests. The annotation may also contain a sub-path relative to the class-level base path, usually configured with @RequestMapping.

The content of the posted HTML form is presented to the method as a domain model data object: when the form is submitted, the fields in the form are bound to properties of the domain model object instance. In the example below, the form is used to build a taco composition:

@PostMapping
public String processFormContent(Taco taco) {

  // ...
  return "redirect:/orders/current";
}