`
zhk0377
  • 浏览: 9836 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

使用struts时,css等文件不能放到以static或struts开头的文件夹里!

阅读更多

起因:在web.xml里配置struts的过滤器后,静态页面效果无法显示

 

  经多次排查调试终于发现了问题

  我的css的文件在statics文件夹里放着

 

 

这是org.apache.struts2.dispatcher包里

 

DefaultStaticContentLoader类的一个方法
 public boolean canHandle(String resourcePath) {
        return serveStatic && (resourcePath.startsWith("/struts") || resourcePath.startsWith("/static"));
    }

 

 

这时才恍然:

  struts工程里放置样式 等的文件

  不能以static和struts开头

0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics