java - Why am I getting 400 bad request with AngularJs post? -
I use Spring MVC and AngularJs to create a web application. I send a request to the server, but I'm getting a Here's my angular service: And on the server side, I have a spring MVC controller as described below: I saw a bit more: When I remove The problem was about the user form. I had the last name, first name, email, password, password 1 but the user is not password 1 attribute in the Java object when the JSN data provided by the request does not conform to the Java object, then the data from the JSON Kanan Java object Can not match. 400 error bad request . I configure message converter for Jason format in the spring servlet configuration file. I wonder why I got this error.
save: function (user) {return $ http ({method: 'POST', Url: '/ app-web / user / Create ', contentType: "application / json", data: user}); }
@RequestMapping (value = "/ user / create" Method = RequestMethod.POST) @ResponseBody Make Public StringCount (@RequestBody User User) {// Return some argument "OK"; }
@equestBody in the controller, I do not have 400 error but user
null @RequestMapping (value = "/ user / create", method = RequestMethod.POST) @ResponseBody makes public string rights (user users) {// Some logic returns "OK" ; }
Comments
Post a Comment