java - How to mark Spring MVC params as required -
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 id, , name required. in other words, if null values, exception must thrown.
how can that? there annotation or that?
thanks
yes, there is. @requestparam(required=true)
see docs.
required flag true default, need is:
@requestmapping(value = "/updatearticle", method = requestmethod.post) @responsebody public void updatearticle(@requestparam long id, @requestparam string name, @requestparam string description) { ... }
Comments
Post a Comment