Wednesday, 15 May 2013

java - @RequestPart("json") as a property in ModelAttribute -


Is there a way to embed the Jasonan object in the model attribute in Spring MVC? For example on the client side:

  var obj = JSON.parse (user); // User is a JSON string that contains user object information var formData = new form data (); Formdata.append ("userInfo", obj); On the server side,  

@RequestMapping (value = "/ here", method = {RequestMethod.POST, RequestMethod.GET}, header = "Content -type = multipart / form-data ") @ResponseBody public string doSomething (@ModelAttribute MyForm myForm, HttpServletRequest request, HttpServletResponse response) {user user = myForm.getUserInfo (); }


No comments:

Post a Comment