How to call object's method from Thymeleaf?

That can be done in Thymeleaf in two ways:

First is to use special for Thymeleaf:

<head th:fragment="publicSiteHeader">

    <title>SOME TITLE</title>

     <th:block th:text="${CSSProcessor.setDebugCaller("Public")}"/>
     <th:block th:text="${CSSProcessor.setSiteRegion("public")}"/>
     <th:block th:text="${CSSProcessor.addCSS("/css/main.css")}"/>
</head>

And the second way is:

<head th:fragment="publicSiteHeader" th:inline="text">

    <title>SOME TITLE</title>

     [["${CSSProcessor.setDebugCaller("Public")}"]]
     [["${CSSProcessor.setSiteRegion("public")}"]]
     [["${CSSProcessor.addCSS("/css/main.css")}"]]
</head>

For natural template processing second option is more preferable. More info about inlining can be found here: http://www.thymeleaf.org/doc/tutorials/2.1/usingthymeleaf.html#inlining


You can call methods via thymeleaf but it is not a good practice. The thymeleaf has different philosophy than JSP - it tries to use valid HTML templates. And to be honest: Calling methods in JSP is not good practice as well. But I am not your judge, so to call a method use non visible span or div, try something like:

<span th:text="${myvariable.myfunct()}" />