How to call object's method from Thymeleaf?

后端 未结 3 1748
无人及你
无人及你 2020-12-16 21:56

My template do not see objects, passed from Spring.

My code:

public class PublicModelAndView extends ModelAndView {

    @Autowired
    TemplateModul         


        
3条回答
  •  遥遥无期
    2020-12-16 22:17

    That can be done in Thymeleaf in two ways:

    First is to use special for Thymeleaf:

    
    
        SOME TITLE
    
         
         
         
    
    

    And the second way is:

    
    
        SOME TITLE
    
         [["${CSSProcessor.setDebugCaller("Public")}"]]
         [["${CSSProcessor.setSiteRegion("public")}"]]
         [["${CSSProcessor.addCSS("/css/main.css")}"]]
    
    

    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

提交回复
热议问题