Volodymyr Levytskyi
Volodymyr Levytskyi

Reputation: 3432

How to convert many url parameters into object as argument of @Controller method?

I need to pass many request params to @Controller.

So I want all these params to be wrapped into object which is provided as argument of @Controller by spring mvc. I also want to use @Valid annotation on this argument.

This is the same as @RequestBody with POST http method.

But I need object like @RequestBody with GET http method.

How to put all request params into single object which is provided as argument in @Controller method?

Upvotes: 0

Views: 44

Answers (1)

M Rajoy
M Rajoy

Reputation: 4114

You can use @RequestBody as well, but you also have @ModelAttribute annotation to map parameters into a bean's properties.

Upvotes: 1

Related Questions