I've downloaded a bootstrap template and I'm trying to serve the page using Thymeleaf and Spring MVC. When I open the actual page statically on my computer it shows up as it was shown online, but when I start my Spring Boot application I get errors in the parsing of the HTML file. Example: rg.xml.sax.SAXParseException: Open quote is expected for attribute "onclick" associated with an element type "a".
All of the exceptions I get are with rg.xml.sax.SAXParseException and no matter how many I change it wants me to fix more so I realized this must be a configuration issue, because how else would it work statically.
So hoping I can get some pointers: Here is the head of my HTML file:
<html xmlns:th="http://www.thymeleaf.org">
<head lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="description" content=""/>
<meta name="author" content=""/>
<title>Stylish Portfolio - Start Bootstrap Theme</title>
<link href="../static/css/bootstrap.min.css"
th:href="@{css/bootstrap.min.css}" rel="stylesheet"/>
<!-- Custom CSS -->
<link href="../static/css/stylish-portfolio.css"
th:href="@{css/stylish-portfolio.css}" rel="stylesheet"/>
<!-- Custom Fonts -->
<link href="../static/font-awesome/css/font-awesome.min.css"
th:href="@{font-awesome/css/font-awesome.min.css}" type="text/css"/>
</head>
Now, I thought this was a Thymeleaf issue, but I took all the Thymeleaf away and make the same file with this header and got the same HTML errors:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="description" content=""/>
<meta name="author" content=""/>
<title>Stylish Portfolio - Start Bootstrap Theme</title>
<link href="../static/css/bootstrap.min.css"/>
<!-- Custom CSS -->
<link href="../static/css/stylish-portfolio.css"/>
<!-- Custom Fonts -->
<link href="../static/font-awesome/css/font-awesome.min.css"/>
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css"/>
</head>
Here is the endpoint that is serving this content:
@RequestMapping(value = "/test", method = RequestMethod.GET)
public static String test() throws RuntimeException {
try{
return "index_bootstrap";
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Any pointers as to why I get errors like these would be a huge help:
2016-12-27 20:53:16.956 ERROR 73461 --- [nio-8080-exec-1] o.thymeleaf.templateparser.ErrorHandler : [THYMELEAF][http-nio-8080-exec-1] Fatal error during parsing
org.xml.sax.SAXParseException: Open quote is expected for attribute "onclick" associated with an element type "a".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) [xercesImpl-2.11.0.jar:na]
2016-12-27 20:53:16.959 ERROR 73461 --- [nio-8080-exec-1] org.thymeleaf.TemplateEngine : [THYMELEAF][http-nio-8080-exec-1] Exception processing template "index2": Exception parsing document: template="index2", line 34 - column 36
2016-12-27 20:53:16.963 ERROR 73461 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: Exception parsing document: template="index2", line 34 - column 36] with root cause
org.xml.sax.SAXParseException: Open quote is expected for attribute "onclick" associated with an element type "a".