这应该是一个容易的,但我找不到任何解决方案.
原文链接:https://www.f2er.com/angularjs/140696.html我在Jetty上使用Spring Boot 1.0.2与Thymeleaf支持我的AngularJS应用程序.但是,当使用attribute指令时,解析器会引发异常.
的pom.xml
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <dependency> <groupId>net.sourceforge.nekohtml</groupId> <artifactId>nekohtml</artifactId> <version>1.9.20</version> </dependency>
Thymeleaf配置
@Configuration public class ThymeleafConfig { @Bean public ServletContextTemplateResolver templateResolver() { ServletContextTemplateResolver resolver = new ServletContextTemplateResolver(); resolver.setPrefix("/templates/"); resolver.setSuffix(".html"); resolver.setTemplateMode("LEGACYHTML5"); resolver.setCacheable(false); return resolver; } @Bean public ResourceBundleMessageSource messageSource() { ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource(); messageSource.setBasename("messages"); messageSource.setDefaultEncoding("UTF-8"); return messageSource; } }
Thymeleaf正在工作,但它与属性指令有一个问题,像这样的Bootstrap UI示例:
<div class="btn-group" dropdown is-open="true"> <button type="button" class="btn btn-primary dropdown-toggle">Button dropdown <span class="caret"></span> </button> <ul class="dropdown-menu" role="menu"> <li><a href="#">Action</a></li> <li><a href="#">Another action</a></li> <li><a href="#">Something else here</a></li> <li class="divider"></li> <li><a href="#">Separated link</a></li> </ul> </div>
我收到这个错误
org.xml.sax.SAXParseException: Attribute name "dropdown" associated with an element type "div" must be followed by the ' = ' character.
在哪里可以调整百里香,以接受这些属性?
– -编辑 – –
我为LEGACYHTML5添加了nekoHTML解析器,但仍然没有结果.