Spring Boot + Thymeleaf Error: ERROR 8592 org.thymeleaf.TemplateEngine
Error Message:
org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: “class path resource [templates/…….html]”)
……ERROR 8592 — [p-nio-80-exec-7] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: “class path resource [templates/…….html]”)] with root cause
Problem location and solution
1、Location
Checked the return value of the Controller, path spelling, annotations and so on are not found problems
Fortunately, there is a page can be displayed normally, so the exchange comparison, found that the problem in the <!DOCTYPE> tag
2, solve
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
Change to
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
or
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
I think it’s puzzling, but because of the project problem, the front end can only use this webpage written with a lot of obsolete tags. Thymeleaf has strict requirements on the front end, and suggests that H5 standard be used in new projects.
extend
Here is a configuration method to turn off strict syntax checking for thymeleaf
1. In pom.xml Add dependency to file
<dependency>
<groupId>net.sourceforge.nekohtml</groupId>
<artifactId>nekohtml</artifactId>
<version>1.9.21</version>
</dependency>
2. In application.properties Add in
spring.thymeleaf.mode=LEGACYHTML5
Read More:
- Spring boot thymeleaf crud implements simple functions of adding, deleting, modifying and querying
- org.thymeleaf.exceptions.TemplateInputException: Error resolving template [XXX]
- Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.4.0:repackage failed
- Spring boot problem 1: error reporting life processing instructions for building a spring boot project
- Solve the problem of There was an unexpected error (type=Internal Server Error, status=500) (using Thymeleaf to report an error)
- The background object of thymeleaf is null, which solves the problem of error when the object is empty to get the property value
- Add PageHelper spring boot starter dependency to springboot and report an error
- 13.2 spring boot start error: whitelabel error page
- Specify the configuration file when the spring boot command starts
- Spring boot problem solving record (1)
- spring boot Whitelabel Error Page
- Spring boot prompt could not resolve placeholder in string value
- Spring boot integrates es cluster error report collection
- Error processing condition on org.springframework.boot . autoconfigure.context.Property Error report solution
- The spring boot project directly replaces the referenced jar package
- Failure of spring boot configuration server port
- Spring boot project running error: Servlet.service () for servlet [dispatcherServlet] threw exception
- Spring boot running appears java.lang.IllegalStateException : Failed to load ApplicationContext
- Spring boot can’t scan XML (invalid bound statement (not found))
- spring boot-beans in application context form a cycle