A typical case is HTML attributes for event handlers (e.g. "onload"), in which textual data from va

thymeleaf th:onclike passes in multiple strings

  • Original code
th:οnclick="'javascript:searchHot(\''+${hot.name}+'\')'"
  • This problem is not an error, but the reason of the springboot version. The new version (version 2.xxx) will report an error if the method is used. The old version (version 1.3 I tried) is feasible with this method.
  • Solution
th:onclick="searchHot([[${hot.name}]]);"

Guess you like

Origin blog.csdn.net/JISOOLUO/article/details/104831484