[SOLVED] 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.

Error added: 2022-04-05T08:43:09Z

0 people waiting for the answer...

1 answers found.

Answer 2713 (75.0% helpful)

<div th:data-thing="${mydata}" onclick="doSomething(this.getAttribute('data-thing'));">

Add an answer/solution

If you know the answer, please add your own solution below.
If you don't know, but find out later, please come back and share your answer - there will be other people struggling with this too.

Please enter 61948 here

If you want to be notified via email when this is solved, enter your email address here: