我用的一个SpringBoot项目,将css js 图片等,放在了resources/static下面,将html放在了templates下面。
配置文件里面有
mvc:
static-path-pattern: /static/**
resources:
static-locations: classpath:/static/
在html中有设置
<script type="text/javascript" src="static/js/jquery-1.8.0.js" ></script>
<script type="text/javascript" src="static/js/jquery.easing.js"></script>
<script type="text/javascript" src="static/js/jquery.scrollpath.js"></script>
<script type="text/javascript" src="static/js/index.js"></script>
<!-- <script type="text/javascript" th:src="@{/js/jquery-1.8.0.js}" ></script>-->
<!-- <script type="text/javascript" th:src="@{/js/jquery.easing.js}" ></script>-->
<!-- <script type="text/javascript" th:src="@{/js/query.scrollpath.js}" ></script>-->
<!-- <script type="text/javascript" th:src="@{/js/js/index.js}" ></script>-->
<link rel="stylesheet" href="../css/css.css" type="text/css" media="screen"/>
<!-- <link th:href="@{../css/css.css}" rel="stylesheet" type="text/css" />-->
注释掉的也试了一下,也没有用。
pom中是一个不指定版本的,为默认最新版吧