Java – spring boot and thymeleaf – remove strict HTML error checking

I use spring boot as an MVC application, and my view technology is thymeleaf One thing I need to do is copy the HTML of the existing website (not what I did...) and render it with thymeleaf However, the source HTML of some websites contains unclosed HTML tags (such as < meta >, < link >, < input >) or HTML tags, in which the elements are not enclosed in quotation marks, such as:

<div id=1></div>

replace

<div id="1"></div>

Of course, this works in browsers... But thymeleaf does not allow this and will not serve pages Is there any way to make this more relaxed rule? I searched thymeleaf's documentation and spring boot references, but I couldn't find the answer

Just to clarify - I didn't even configure my own bean for thyemeleaf, just added it to the classpath as one of the spring boot starters through Maven So now these are the default settings

Solution

As @ mussdroid said, everything needs valid XML The following is a part of the thymeleaf documentation that explains this background: http://www.thymeleaf.org/doc/articles/fromhtmltohtmlviahtml.html

In addition, if this is a problem, I believe you can open the legacy schema to allow non XML templates, but I want to use valid XML as much as possible: http://www.thymeleaf.org/doc/tutorials/2.1/usingthymeleaf.html#what -kind-of-templates-can-thymeleaf-process

I don't know how to change the mode myself, but I'm sure duckduckgo can or someone on this website

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>