A parameter that is a bean containing form parameters.
The properties on the bean are by default treated as form parameters.
If they have no other annotations like @QueryParam
, or
@Header
etc they are populated as form parameters.
The properties can have other annotations like @QueryParam
,
@Header
, @Cookie
, @Default
.
We would explicitly annotate a property with @FormParam
if
the form property name is snake case or similar that doesn't map to a
valid java/kotlin variable.
Example 1
Simple form bean, properties default to form parameters matching the property name.
public class MyForm {
public String id;
public String name;
}
...
@Post
void postForm(@Form MyForm fooForm) {
...
}
Example 2
Form bean with various annotations.
public class MyForm {
@FormParam("start-date")
public LocalDate startDate;
@Default("Fred")
public String myName;
@Cookie
public String lastActive;
}