Using thymeleaf variable in onclick attribute
thymeleaf 3.0.10 th:onclick thymeleaf variable not working
This should work:
th:attr="onclick=|upload('${gallery}')|"
I solve this issue with this approach:
th:onclick="|upload('${command['class'].simpleName}', '${gallery}')|"