2015-06-02 86 views
1

我試圖發展與春天啓動的應用程序,我有以下的HTML春天的SAXParseException

<!doctype html> 
<html ng-app> 
<head> 
<title>Hello AngularJS</title> 
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"></script> 
<script src="hello.js"></script> 
</head> 

<body> 
<div ng-controller="Hello"> 
<p>The ID is {{greeting.id}}</p> 
<p>The content is {{greeting.content}}</p> 
</div> 
</body> 
</html> 

我得到這個錯誤,我不知道爲什麼,這是相同的代碼從https://spring.io/guides/gs/consuming-rest-angularjs/的例子

org.xml.sax.SAXParseException:與元素類型「html」關聯的屬性名稱「ng-app」必須後跟'='字符。

+0

我不認爲Spring Boot在這裏做了一些特別的事情。檢查百里香設置:http://www.thymeleaf.org/doc/usingthymeleaf.html#what-kind-of-templates-can-thymeleaf-process。您也可能會發現這個討論很有用:https://github.com/spring-projects/spring-boot/issues/1270 – Maks

回答

0

此行似乎有問題我

<html ng-app> 

嘗試這一行

<html ng-app=""> 

,因爲如果你不希望把你的應用程序angularJS然後聲明爲空。另外我會建議使用ng-app=""body標籤而不是html標籤

+0

解決方案是像麥克斯建議的那樣添加spring.thymeleaf.mode = LEGACYHTML5,而且這也證明了成爲一個解決方案,但它一直在做這件事很煩人 – Victor