《index.html》错误代码:
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org>
<head>
<meta charset=" UTF-8">
<title>Title</title>
</head>
<body>
<h1>首页</h1>
</body>
</html>
报异常:
[http-apr-8080-exec-7] DEBUG org.springframework.web.servlet.DispatcherServlet - Failed to complete request: org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "ServletContext resource [/WEB-INF/templates/index.html]" - line 2, col 1)
经检查原因是HTML标签中少了一个右分号。
正确代码
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset=" UTF-8">
<title>Title</title>
</head>
<body>
<h1>首页</h1>
</body>
</html>