在springmvc.xml中进行设置;

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.1.xsd">
...
<!-- 进行资源的映射 -->
<mvc:resources location="/resources/" mapping="/resources/**" />
... </beans>

在web.xml中的设置;

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<servlet>
<servlet-name>user</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/springmvc.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>user</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping> <!-- 解决工程编码过滤器 -->
<filter>
<filter-name>characterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter> <filter-mapping>
<filter-name>characterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>

spring mvc 资源包的映射的更多相关文章

  1. spring mvc: 多解析器映射(资源绑定视图解析器 + 内部资源[普通模式/]视图解析器)

    spring mvc: 多解析器映射(资源绑定视图解析器 + 内部资源[普通模式/]视图解析器) 资源绑定视图解析器 + 内部资源(普通模式)视图解析器 并存方式 内部资源视图解析器: http:// ...

  2. spring mvc: 资源绑定视图解析器(不推荐)

    spring mvc: 资源绑定视图解析器(不推荐) 不适合单控制器多方法访问,有知道的兄弟能否告知. 访问地址: http://localhost:8080/guga2/hello/index 项目 ...

  3. Spring MVC多解析器映射

    如果想在spring mvc应用程序中使用多个视图解析器,那么可以使用order属性设置优先级顺序. 以下示例显示如何在Spring Web MVC框架中使用ResourceBundleViewRes ...

  4. Spring MVC资源绑定视图解析器

    ResourceBundleViewResolver使用属性文件中定义的视图bean来解析视图名称. 以下示例显示如何使用Spring Web MVC框架中的ResourceBundleViewRes ...

  5. Spring MVC 基于Method的映射规则(注解版)

    在Restful风格的web开发中,根据不同的请求方法使用相应的控制器处理逻辑成为核心需求,下面就看看如何在Spring MVC中识别不同的请求方法. 请求方法 在Http中,请求的方法有很多种,最常 ...

  6. Spring MVC 基于URL的映射规则(注解版)

    好几天没有跟进Spring MVC的学习了,之前看了点源码都忘的差不多了.这次就跟着之前的问题,继续总结下Spring MVC中的小知识. 关于SpringMVC的小demo可以参考这里! url-p ...

  7. spring mvc 资源映射配置

    在springmvc配置文件中添加 <mvc:resources location="/css/" mapping="/css/**"/> < ...

  8. Spring MVC简单URL处理程序映射

    以下示例显示如何使用Spring Web MVC框架来实现一个简单URL处理程序映射. SimpleUrlHandlerMapping类分别显式地将URL映射到相应的控制器上. 所下所示配置 - &l ...

  9. java spring mvc完整包下载地址

    推荐使用该地址:http://maven.springframework.org/release/org/springframework/spring/ 更多详细参考地址:http://blog.cs ...

随机推荐

  1. mysql连接不上Uncaught exception 'PDOException' with message 'could not find driver

    需要给你的PHP加一个PDO扩展打开PHP.INI 把extension=php_pdo.dll 前面的分号去掉 重启APACHE. extension=php_pdo_mysql.dll

  2. Delphi中register, pascal, cdecl, stdcall, safecall(转)

    源:http://blog.sina.com.cn/s/blog_552c78120100hsr9.html 注: 使用错误,或者在该加的地方没有加,可能会出现"privileged ins ...

  3. Sublime Text 3 搭建 Golang 开发环境

    安装Golang go语言主页: https://golang.org/ go语言安装下载: https://golang.org/dl 环境变量设置: GOROOT: GOROOT变量设置go安装的 ...

  4. 浏览器兼容问题 chrome iframe location href

    报了个错 var dt2=new Date(d2Arr[0],d2Arr[1],d2Arr[2]); if(dt1>dt2){//比较日期 alert("开始日期不能晚于结束日期!&q ...

  5. Nexus搭建私服 学习

    为什么要搭建nexus私服 因为有些公司不提供外网给项目组人员,因此就不能使用maven访问远程的仓库地址,所以,有必要再局域网里找一台有外网权限的机器.搭建nexus私服,然后开发人员连接到这台私服 ...

  6. hibernate的优化

    1.使用双向一对多关联,不实用单项一对多2.不用一对一,使用一对多3.配置对象缓存,不使用集合缓存

  7. SVN参考命令

    SVN 命令参考(svn command reference) 用法: svn <subcommand> [options] [args]Subversion 命令行客户端,版本 1.6. ...

  8. 6种炫酷的CSS3按钮边框动画特效

    6种炫酷的CSS3按钮边框动画特效Button border animate 用鼠标滑过下面的按钮看看效果! Draw Draw Meet Center Spin Spin Circle Spin T ...

  9. PHPCMS v9 列表页实现文件下砸

    {template "content","header"} <div class="list"> <div class=& ...

  10. Arduino中hex文件的保存及应用(转)

    源:Arduino中hex文件的保存及应用 arduino在编译.链接.下载之后,hex文件自动删除了,造成软件仿真(如用proteus仿真)及其他单片机板应用的不便.以下是自己实践的小结,与大家分享 ...