I am trying to make an AJAX call from java script console as below

jQuery.ajax({ contentType: "application/json", url: "/accountServices/resetPassword", type: "POST", data: '{"userName":"local_student","newPassword":"test1231","guid":"376ed5f7-a780-455e-8682-6b5cf45cff80"}' });

And my controller method is something like this.

@RequestMapping(value = "/resetPassword", method = RequestMethod.POST) public String resetPassword(@RequestParam("userName") String userName, @RequestParam("newPassword") String newPassword, @RequestParam("guid") String guid, Model uiModel, HttpServletRequest request, final Locale locale) throws MessagingException { try {} }

I am getting the error

Required String parameter 'userName' is not present.

Could someone please help me out here!

Related posts

Recent Viewed