theymeleaf inline javascript framework issue -


<script th:inline="javascript" type="text/javascript">     //expose list data javascript     var listobject = /*[[${listobject}]]*/ []; </script> 

the replacement text printed file different jackson library's objectmapper does.

with thymeleaf in above example, listobject be

{    "datatype":{       "$type":"datatype",       "$name":"string"    },    "friendlyname":"customer key" } 

if print object objectmapper(which used spring @requestbody/@responsebody),

{    "datatype":"string",    "friendlyname":"customer key" } 

is there way can force thymeleaf compatible objectmapper.

i think this has jackson , json inlining in thymeleaf.
summarize, possibility switch custom textinliners considered 3.0 thymeleaf milestone.

so, there no "clean" way switch jackson json serialization.

what can however, sneak own textinliner. is:

  1. create class org.thymeleaf.standard.inliner.standardjavascripttextinliner.
  2. implement own version of formatevaluationresult(object) method,
    can call jackson objectmapper .
  3. put new standardjavascripttextinliner class in proper place, loaded before original class (f.e. in tomcat put in classes dir under correct package structure).

Comments

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -