Annotation Interface RequestParam
Annotation that binds a method variable to a query parameter.
Example
@Controller("/api")
public class MyController {
// Incoming request looks like "/api/user?user=123"
@GetMapping("/user")
public UserData getUserData(@RequestParam("user") String userId) {
return UserDao.getUserData(userId);
}
}
As you can see, the @RequestParam's parameter name does not need to
match the actual method parameter's name.- Since:
- 1.0
- Version:
- 2022-08-31
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionDefault value if the parameter is not available.booleanIndicates if the parameter is required or not.The name of the query parameter to map to.