I have such method in spring controller
@RequestMapping(value = "/updateArticle", method = RequestMethod.POST)
@ResponseBody
public void updateArticle(Long id, String name, String description) {
...
}
I want the id, and name to be REQUIRED. In the other words, if they are null values, then an exception must be thrown.
How can I do that? Is there any annotation for this or something like that?
Thanks
Yes, there is.
@RequestParam(required=true)
See the docs.Required flag is even true by default, so all you need to do is: