Search code examples
sts-springsourcetoolsuitethymeleaf

Springsource Tools Suite thymeleaf tags are unknown


I am usind Springsource Tools Suite and I want to develop a maven based web project. The parent archetype creator has used thymeleaf tags (th:block). It is working but I get warnings in STS that say: Unkown tag (th:block). How can i fix this warning?


Solution

  • Since I cannot add comment, I will write it here:

    Check three things:

    1. Does maven contain thymeleaf dependencies? something like this.

    2. Do you have Thymeleaf resolver properly set: This is annotation example:

      @Bean
      public ThymeleafViewResolver viewResolver() {
          ThymeleafViewResolver thymeleafViewResolver = new ThymeleafViewResolver();
          thymeleafViewResolver.setTemplateEngine(templateEngine());
          thymeleafViewResolver.setCharacterEncoding("UTF-8");
          return thymeleafViewResolver;
      }
      
    3. Does your view have proper html tag:

      html xmlns="http://www.w3.org/1999/xhtml"
           xmlns:th="http://www.thymeleaf.org"