Hello, So I'm editing a web project that uses spring and I need to start adding some of spring's annotations. Two of the ones I need to add are @RequestBody and @RequestParam. I've been poking around a little and found this, but still don't completely understand what I'm to do with these annotations. Could anyone give me an example?
+1
A:
There are good examples in the documentation, for both @RequestMapping
and @RequestBody
skaffman
2010-07-26 17:41:19
+2
A:
Controller example:
@Controller
class FooController {
@RequestMapping("...")
void bar(@RequestBody String body, @RequestParam("baz") baz) {
//method body
}
}
@RequestBody: variable body will contain the body of the HTTP request
@RequestParam: variable baz will hold the value of request parameter baz
arjan
2010-07-26 17:43:58