在采用springMVC框架的时候所遇到的一个小问题,其中web.xml中关于servlet的配置如下:

<servlet>
<servlet-name>springmvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springmvc</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>

重点是url-pattern 部分的配置,在配置为/*时,会报错WARNING: No mapping found for HTTP request with URI [/springMVC/welcome.jsp] in DispatcherServlet with name 'springmvc'

但是当将该部分配置为/时竟然运行ok了。

网上关于两者的解释如下:

一、<url-pattern>/</url-pattern>: 
会匹配到/springmvc这样的路径型url,不会匹配到模式为*.jsp这样的后缀型url。

二、<url-pattern>/*</url-pattern>: 
会匹配所有的url:路径型的和后缀型的url(包括/springmvc,.jsp,.js和*.html等)。

根据上述说明,按理说第二种配置应该包含第一种才对,可是,运行仍然没有出现结果,也就是说第一种能够运行,第二种一定能够运行,但是实际并没有如此,很是奇怪。

'/'和‘/*’差异造成的No mapping found for HTTP request with URI [/springMVC/welcome.jsp] in DispatcherServlet with name 'springmvc'的更多相关文章

  1. No mapping found for HTTP request with URI [/spring_liu/hello.do] in DispatcherServlet with name 'SpringMVC'

    控制台一直报No mapping found for HTTP request with URI [/spring_liu/hello.do] in DispatcherServlet with na ...

  2. No mapping found for HTTP request with URI [/jiaoyu/student/add] in DispatcherServlet with name 'SpringMVC'

    项目是使用spring MVC (1)在浏览器中访问,后台总报错: No mapping found for HTTP request with URI [/exam3/welcome] in Dis ...

  3. No mapping found for HTTP request with URI [/user/login.do] in DispatcherServlet with name 'dispatcher'错误

    1.警告的相关信息 七月 24, 2017 3:53:04 下午 org.springframework.web.servlet.DispatcherServlet noHandlerFound警告: ...

  4. spring mvc No mapping found for HTTP request with URI [/web/test.do] in DispatcherServlet with name 'spring'

    原因: spring-servlet.xml 中 <context:component-scan base-package="com.test.controller" /&g ...

  5. springmvc No mapping found for HTTP request with URI in Dispatc

    springmvc No mapping found for HTTP request with URI in Dispatc 博客分类: Java Web springmvcspring MVCNo ...

  6. springmvc搭建环境时报No mapping found for HTTP request with URI [/exam3/welcome] in DispatcherServlet with name 'spring2'

    项目是使用spring MVC (1)在浏览器中访问,后台总报错: No mapping found for HTTP request with URI [/exam3/welcome] in Dis ...

  7. spring访问静态资源出错,No mapping found for HTTP request with URI xxx/resources/js/jquery.min.js...

    问题:spring访问静态资源出错,No mapping found for HTTP request with URI xxx/resources/js/jquery.min.js... web.x ...

  8. SpringMvc出现No mapping found for HTTP request with URI的终极解决办法

    No mapping found for HTTP request with URI 出现这个问题的原因是在web.xml中配置错了,如: <servlet> <servlet-na ...

  9. 问题 “No mapping found for HTTP request with URI [/rbiz4/uploadFile.html]” 的解决

    从以前的SpringMVC项目简化一下做个例子,结果出现了下面的错误: No mapping found for HTTP request with URI [/rbiz4/uploadFile.ht ...

随机推荐

  1. dense向量和稀疏向量sparse

    import org.apache.spark.mllib.linalg.Vectors object Test { def main(args: Array[String]) { val vd = ...

  2. JavaScript高级特征之面向对象笔记

    Javascript面向对象 函数 * Arguments对象: * Arguments对象是数组对象 * Arguments对象的length属性可以获取参数的个数 * 利用Arguments对象模 ...

  3. Spring学习(四)

    Spring Ioc容器 1.具有依赖注入功能的容器.负责实例化,定位,配置应用程序中的对象及建立这些对象间的依赖.在Spring中BeanFactory是Ioc容器的实际代表者.BeanFactor ...

  4. @override编译报错

    今天突然遇到一个问题,明明我重写的接口的方法,编译的时候一直报@override is not override a method from superclass,查了一下资料,这个@override ...

  5. swoole 监控文件改动

    <?php /** * 场景: * 进程监控文件改动 */ date_default_timezone_set('PRC'); echo '进程id:' . posix_getpid() . P ...

  6. 【PAT甲级】1033 To Fill or Not to Fill (25 分)(贪心,思维可以做出简单解)

    题意: 输入四个正数C,DIS,D,N(C<=100,DIS<=50000,D<=20,N<=500),分别代表油箱容积,杭州到目标城市的距离,每升汽油可以行驶的路程,加油站数 ...

  7. 三大JavaScript框架对比——AngularJS、BackboneJS和EmberJS

    <三大JavaScript框架对比——AngularJS.BackboneJS和EmberJS> 本文转载自  作者:chszs,博客主页:http://blog.csdn.net/chs ...

  8. uniGUI之学习方法(18)

    官方例子D:\Program Files\FMSoft\Framework\uniGUI\Demos\Desktop 在Design里Main上右键,View as Form看到变化的属性. 看出变化 ...

  9. FFmpeg笔记-基本使用

    FFmpeg是目前最牛逼的开源跨平台音视频处理工具. 准备知识 我不是音视频编解码出身的,对于这一块非常的不了解,导致在学习FFmpeg的时候云里雾里的,所以学习之前最好看些资料对音视频编解码有点认识 ...

  10. js 表格操作----添加删除

    js 表格操作----添加删除 书名:<input type="text" id="name"> 价格:<input type="t ...