我正在创建一个非常基本的小型web应用程序,使用Spring、胸腺和webjars。
我想要的:包括jquery和使用webjars的引导程序
我所做的:我将依赖项包含到我的pom.xml中。
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>2.1.1</version>
</dependency>我将jquery添加到模板index.html中:
<script src="/webjars/jquery/2.1.1/jquery.min.js" type="text/javascript"></script>问题:尽管thymeleaf位于我的/lib目录中,而且看起来一切对我来说都是正确的,但它不起作用。浏览器中显示的HTML文件显示了脚本行,但是试图直接获取jquery库(单击Chrome中的源代码)最终导致HTTP406错误,而路径显示为http://localhost:8080/webjars/jquery/2.1.1/jquery.min.js
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Fri Oct 17 09:34:32 CEST 2014
There was an unexpected error (type=Not Acceptable, status=406).
Could not find acceptable representation发布于 2014-10-17 08:20:02
如何配置WebMVC?
这里您可以找到如何在Spring中使用webjars的介绍。
https://stackoverflow.com/questions/26420214
复制相似问题