How to call object's method from Thymeleaf?

后端 未结 3 1739
无人及你
无人及你 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:26

    Thymeleaf does not work like JSP. It works by extending existing HTML elements with new attributes prefixed by "th:". And you can reference variables (and therefore call method on them) only in theses extra-attributes.

    E.g.

    will work with thymeleaf

    But

    ${contentOfTheParagraph}"

    will not.

提交回复
热议问题