2017-07-28 6 views
2

My HTMLページがjsonオブジェクトの形式でペイロードを取得していません。代わりに文字列を返します。すべてのヘルプjsonオブジェクトを返さないThymeleafフォーム

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

にペイロードを変換し、レンダリング? –

+0

これはJsonにストリング化する必要があります。しかし、文字列はjson形式ではありません。 –

+0

これは役立ちます:https://stackoverflow.com/questions/34001725/how-to-automatically-parse-string-requestbody-as-json –

答えて

0

は、タブをレンダリング。

P.S:payload`がStringである `ので機能は、実際にJSONオブジェクト

formController.render(tabContent, url); 
関連する問題