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

推荐订阅源

Martin Fowler
Martin Fowler
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
雷峰网
雷峰网
J
Java Code Geeks
G
Google Developers Blog
博客园 - 司徒正美
The GitHub Blog
The GitHub Blog
L
LangChain Blog
人人都是产品经理
人人都是产品经理
GbyAI
GbyAI
Vercel News
Vercel News
S
SegmentFault 最新的问题
Engineering at Meta
Engineering at Meta
H
Hackread – Cybersecurity News, Data Breaches, AI and More
云风的 BLOG
云风的 BLOG
F
Fortinet All Blogs
Y
Y Combinator Blog
博客园_首页
Last Week in AI
Last Week in AI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
罗磊的独立博客
A
About on SuperTechFans
B
Blog
Microsoft Security Blog
Microsoft Security Blog

博客园 - 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'