Home  >  Article  >  Web Front-end  >  Parsing springboot using thymeleaf times html has no closing tag

Parsing springboot using thymeleaf times html has no closing tag

高洛峰
高洛峰Original
2017-03-31 11:20:495585browse

In the process of using springboot, if you use thymeleaf as a template file, the HTML format must be strict html5 format, there must be an end tag, otherwise an error will be reported! The solution is as follows:

1. You can use strict tags, that is, each tag has an end tag. This possibility It’s troublesome

2. Add spring.thymeleaf.mode=LEGACYHTML5 in application.properties, which means that thymeleaf uses non-strict HTML. After starting, the following error will be reported when accessing the page:

org.thymeleaf.exceptions.ConfigurationException: Cannot perform conversion to XML from legacy HTML: The nekoHTML library is not in classpath. nekoHTML 1.9.15 or newer is required for processing templates in "LEGACYHTML5" mode [http://nekohtml.sourceforge.net]. Maven spec: "net.sourceforge.nekohtml::nekohtml::1.9.15". IMPORTANT: DO NOT use versions of nekoHTML older than 1.9.15.
	at org.thymeleaf.templateparser.html.AbstractHtmlTemplateParser.parseTemplate(AbstractHtmlTemplateParser.java:90) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE]
	at org.thymeleaf.TemplateRepository.getTemplate(TemplateRepository.java:278) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE]
	at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1104) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE]
	at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1060) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE]

The above exception has been made very clear. You need to rely on nekoHTML 1.9.15 or newer version. The maven dependencies are as follows

## /groupId>

9bc4cbb67f66e148869423c0d27e5f90nekohtmlb68fb17cb904a46b73e6272850323873

3d689bd3819ead35ed794427bd12f4591.9.2283a577b3f930c490b31329be5e672d0b

09a0e22e5aaafd848ae04665be625b91

Now you can access it normally.

The above is the detailed content of Parsing springboot using thymeleaf times html has no closing tag. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn