Rud*_*idt 4 java spring spring-mvc angularjs angularjs-directive
angularjs功能被称为指令导致spring mvc中的问题.如果我使用百日咳来渲染带有元素的html
<div ui-view autoscroll="false"></div>
Run Code Online (Sandbox Code Playgroud)
我得到了一个错误
org.xml.sax.SAXParseException: Attribute name "ui-view" associated with an element type "div" must be followed by the ' = ' character.
Run Code Online (Sandbox Code Playgroud)
是否有一个优雅的解决方法或我应该使用除百里香叶以外的其他东西?
编辑:
非常感谢你的回答,他们帮助了我很多.
要么编码xml,要么使用一些解决方法.打开您的application.properties并添加以下内容
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=LEGACYHTML5
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.content-type=text/html
spring.thymeleaf.cache=false
Run Code Online (Sandbox Code Playgroud)
只需输入以下代码即可.基本上它说的是HTML中的每个属性都应该有一个值.当浏览器呈现它时,无论如何都会如下所示.
<div ui-view="" autoscroll="false"></div>
Run Code Online (Sandbox Code Playgroud)
更新:您还可以在类中使用指令或作为元素使用.
| 归档时间: |
|
| 查看次数: |
1920 次 |
| 最近记录: |