2017-07-28 32 views
2

我的Html页面没有以json对象的形式检索有效载荷。相反,它正在返回字符串。任何帮助Thymeleaf表单不返回json对象

HTML代码段:

<form th:object="${case}" novalidate="true" data-model="case" action="/hcp/patient/details/insurance" method="POST"> 

控制器:

@RequestMapping(
      value = {"/hcp/patient/details/insurance"}, 
      produces = "application/json", 
      method = {RequestMethod.PUT, RequestMethod.POST}) 
    final @ResponseBody String updatePatientInsurance(final HttpServletRequest request, 
      @RequestBody String payload, 
       BindingResult bindingResult) throws InvalidFormException, Exception { 
+0

因为'payload'是字符串? –

+0

它应该串起Json。但是该字符串不是json格式。 –

+0

这可能有所帮助:https://stackoverflow.com/questions/34001725/how-to-automatically-parse-string-requestbody-as-json –

回答

0

明确呈现的标签时访问解决的问题。

P.S:渲染功能实际上转换有效载荷JSON对象

formController.render(tabContent, url);