最近这段时间在使用Spring Boot工程中访问静态html页面,
文件目录,
-src/main/resources
-templates
-index.html
-static
-js
-css
在写好HTML和css等后,浏览器访问,但是报错了,
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Wed Jul 19 19:36:33 CST 2017
There was an unexpected error (type=Internal Server Error, status=500).
Exception parsing document: template=”index”, line 7 - column 3
查看控制台后发现,
org.xml.sax.SAXParseException: 元素类型 "link" 必须由匹配的结束标记 "</link>" 终止。
....
也就是说index.html第7行第3列处出现了错误,是link标签没有结束,查看index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>App</title>
<link rel="stylesheet" href="css/toast.css">
</head>
....
确实在link处出现了此问题。
解决办法: 给对应的标签添加一个结束的标志就可以啦