Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3655

Ajax JQuery to Spring @RequestBody? How do I pass data?

$
0
0

Ajax JQuery to Spring @RequestBody? How do I pass data? I being doing spring for sometime now with passing form fields but I am working on a new system and we would like to use Ajax and RESTful to pass data. My controller looks like the sample one below but can someone please me with the ajax call to post it?? how do I post to the Spring controller and put the data in the body

@RequestMapping(method=RequestMethod.PUT, value="/employee/{id}")public ModelAndView updateEmployee(@RequestBody String body) {        Source source = new StreamSource(new StringReader(body));        Employee e = (Employee) jaxb2Mashaller.unmarshal(source);        employeeDS.update(e);        return new ModelAndView(XML_VIEW_NAME, "object", e);    }

Viewing all articles
Browse latest Browse all 3655

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>