gpt4 book ai didi

java - webjars -> HTTP 406

转载 作者:行者123 更新时间:2023-11-30 03:42:53 26 4
gpt4 key购买 nike

我正在使用 Spring Boot、thymeleaf 和 webjars 创建一个非常基本的小型 Web 应用程序。

我想要什么:使用 webjars 包含 jquery 和 bootstrap

我做了什么:我将依赖项包含到我的 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 jar 位于我的/lib 目录中,并且一切看起来对我来说都是正确的,但它不起作用。浏览器中显示的 HTML 文件显示了脚本行,但尝试直接获取 jquery 库(在 Chrome 浏览器中单击源)最终会出现 HTTP 406 错误,而路径显示为 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

最佳答案

如何配置 WebMVC?

Here您可以找到如何将 webjar 与 Spring WebMVC 一起使用的介绍。

关于java - webjars -> HTTP 406,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26420214/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com