Thymeleaf - The difference between th:field="${}" and th:field="*{}"

Dave picture Dave · Jun 9, 2016 · Viewed 14.4k times · Source

I can't find on the tutorial the difference between this two instructions.

th:field="${something}" and th:field="*{something}"

Can anyone show me some example?

Answer

Anand Rockzz picture Anand Rockzz · Oct 13, 2016

Reference site

Five types:

  • ${...} : Variable expressions. These are OGNL expressions (or Spring EL if you have spring integrated)

  • *{...} : Selection expressions. Same as above, excepted it will be executed on a previously selected object only

  • #{...} : Message (i18n) expressions. Used to retrieve locale-specific messages from external sources

  • @{...} : Link (URL) expressions. Used to build URLs
  • ~{...} : Fragment expressions. Represent fragments of markup and move them around templates