Caused by: org.thymeleaf.exceptions.TemplateProcessingException: Only variable expressions returning

 The front with template engine is thymealeaf, there is a problem when you add a click event to a label.

Originally written like this, no question, this time the error.

<a href="javascript:void(0);" th:οnclick="'contactUs(\''+${supply.phone}+'\')'">联系咨询</a>
Caused by: org.thymeleaf.exceptions.TemplateProcessingException: Only variable expressions
returning numbers or booleans are allowed in this context, any other datatypes are not 
trusted in the context of this expression, including Strings or any other object that could 
be rendered as a text literal. A typical case is HTML attributes for event handlers (e.g. 
"onload"), in which textual data from variables should better be output to "data-*" 
attributes and then read from the event handler. 

 This can then correct the following:

<a href="javascript:void(0);" th:οnclick="contactUs([[${supply.phone}]])">联系咨询</a>

An error log parameter is only allowed to say or Boolean values, and then I tried it long type, but it does. So after note, or directly after discarding the first to adopt the second way.

Published 39 original articles · won praise 6 · views 30000 +

Guess you like

Origin blog.csdn.net/qq_40155654/article/details/100578768