Spring Boot:Exception parsing document: template="index", line 7

来源:互联网 发布:云计算新闻 编辑:程序博客网 时间:2024/06/16 15:41

今天在Spring Boot工程中测试访问静态的html文件
文件目录:

-src/main/resources    -templates        -index.html    -static        -js        -css

在写好html文件和js以及css文件以后,浏览器访问
http://localhost:5876/app/manage/index,
目的是要映射到index.html,但是却报错了。

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处出现了此问题。
解决办法: 给对应的标签添加一个结束的标志就可以啦

<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8" />    <title>App</title>    <link rel="stylesheet" href="css/toast.css" /></head>....

本来是个小问题,细心一点就可以避免啦!
(但是在单独访问静态html文件时是没有问题的,使用的jQuery1.10.2,不知道为什么会有这样的问题)

阅读全文
0 0