[Thymeleaf & Spring] Error caused by not putting / at the end of meta tag

Studying web development with Spring Boot. Record for notes.

When using thymeleaf, if you do not put / at the end of the meta tag in the head tag, an error that White label Error Page is displayed occurs. I found the following words when I traced the STS log.

org.xml.sax.SAXParseException: Element type "meta" must end with the corresponding end tag "\ </ meta>".

Therefore, modify the code of the corresponding html file as follows. (Add a slash at the end)

python


//Original code
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">

//Revised
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8"/>

The web page is now displayed correctly. However, I don't know the exact reason. In terms of HTML, the way to write the original code should be correct. .. .. Is it necessary to clarify that it is thymeleaf?

Postscript

After playing around with it for a while, it seems that even something like an input tag that doesn't need a closing tag needs a / at the end.

end

Recommended Posts

[Thymeleaf & Spring] Error caused by not putting / at the end of meta tag
About the error caused by bundle install ~ puma Gem ~
The idea of cutting off when the error is not resolved
Why put a line break at the end of the file
About the behavior at the time of error of Files.copy (pathA, pathB)