---
title: "Spring MVC，访问静态资源（导入jQuery库）"
author: "longying2008"
date: "2014-06-18T14:36:47Z"
tags: ["SpringMVC"]
categories: ["编程语言"]
slug: "spring-mvc-jquery"
draft: false
lastmod: "2013-07-03T21:06:22Z"
id: 1897908
url: "https://longying2008.iteye.com/blog/1897908"
---

工程的结构如下图所示：

 

![](http://dl2.iteye.com/upload/attachment/0086/4656/55388bf3-47f6-339a-8c6d-3057a91d753c.png)

 

操作：向testJSON.jsp文件中导入jquery-1.10.1.js

 

在springTest-servlet.xml添加如下代码：

```
<!-- 处理静态资源 -->
<mvc:resources mapping="/static/**" location="/WEB-INF/static/" />
```

 

在testJSON.jsp中引用，在&lt;head&gt;节点中添加如下代码：

```
<script type="text/javascript" src="../static/js/jquery-1.10.1.js"></script>
```