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

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -