惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
量子位
C
Check Point Blog
B
Blog RSS Feed
Y
Y Combinator Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
A
About on SuperTechFans
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 聂微东
阮一峰的网络日志
阮一峰的网络日志
人人都是产品经理
人人都是产品经理
小众软件
小众软件
Last Week in AI
Last Week in AI
博客园 - 【当耐特】
GbyAI
GbyAI
The Cloudflare Blog
博客园 - 叶小钗
S
SegmentFault 最新的问题
博客园 - Franky
Engineering at Meta
Engineering at Meta
F
Fortinet All Blogs
B
Blog
Jina AI
Jina AI

博客园 - Liren

查找目录中同名的文件或者文件夹 获取设置一个字节某一个位的数值 基于JMS的数据交换既数据互操作平台的解决方案 Spring MVC基于注解的Junit测试 博文阅读密码验证 - 博客园 NotificationManager - Liren - 博客园 发送短信 调用系统联系人列表 MorseCodeConverter 自用留存 - Liren - 博客园 Android 给自己的类加个事件 用代码旋转屏幕 - Liren - 博客园 Android SQLiteHelper Cassandra API60 Java 代码示例 Cassandra Java 使用TimeUUIDType 转:在 CLI 中練習 Data Model asp.net 实现一个简单CAS Server - Liren Ajax跨域访问代理类,支持GET和POST方法 Python 学习笔记:需要仔细阅读一个函数 Python 学习笔记: 备份工具
Spring MVC 3中关于url-pattern设成"/"后,资源访...
Liren · 2011-11-28 · via 博客园 - Liren

SpringMVC3中关于url-pattern设成"/"后,CSS等资源的访问会报错:No mapping found for HTTP request with URI。

解决办法是将资源类文件夹放到resources目录中,然后在 servlet-context.xml中 添加

xmlns:mvc="http://www.springframework.org/schema/mvc"

<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
<resources mapping="/resources/**" location="/resources/" />

运行服务输出:

INFO : org.springframework.web.servlet.handler.SimpleUrlHandlerMapping - Mapped URL path [/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'