java ee - Avoiding POST requests resulting in "400 - Bad Request" status code in Spring MVC -
i have spring mvc application using annotation configuration. test controller looks that:
@requestmapping(value = "/add", method = requestmethod.post) public string addnumber(@requestparam("name") long somenumber) { ... return "redirect:/showall/"; }
when user posts data controller , not enter valid long number ("somenumber"), spring mvc responds 400 - bad request http status code. application not chance react on error.
how problem handled?
i think best way handle add 'required' parameter requestparam annotation.
@requestparam(value="name", required=false)
Comments
Post a Comment