thymeleaf call a static class

Why you need to call the local static method  Thymeleaf template which sometimes need to use a local static constant, if passed every control layer in a lot of trouble again

We need to use our templates such as Thymeleaf 1 represents the first grade, 2 for second grade, third grade, etc. 3 represents the need to use the notes on the title. Of course, you can use a switch statement, but this is very troublesome, write a lot of labels. The simplest way is to write a static method locally, and then call directly in the template like inside.

Thymeleaf call the local static method  due Thymeleaf document is very small, simple, but do not get this stuff is really bad, or is the old error. Fortunately, finally found it, here it is simply using the method in use is called with T local static method  <a th:target="${T(com.myi.cms.util.ThymeleafUtils).getTarget(column.openType)}"></a>explain column.openType need to pass this parameter, com.myi.cms.util.ThymeleafUtils this is the full path name of the class , getTarget static method  Thymeleaf local static method call attention  first call must be a static method is Thymeleaf the following built-in method code sample: 

Guess you like

Origin www.cnblogs.com/XingXiaoMeng/p/11409625.html