springmvc No mapping found for HTTP request with URI in Dispatc
项目是使用spring MVC
(1)在浏览器中访问,后台总报错:
- No mapping found for HTTP request with URI [/exam3/welcome] in DispatcherServlet with name 'spring2'
查了好半天,才发现是controller 没有扫描到。
我是使用的注解。
spring mvc配置文件如下:
- <?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:context="http://www.springframework.org/schema/context"
- xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:mvc="http://www.springframework.org/schema/mvc"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.2.xsd
- http://www.springframework.org/schema/aop
- http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
- http://www.springframework.org/schema/tx
- http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
- http://www.springframework.org/schema/mvc
- http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd"
- >
- <!-- HandlerMapping -->
- <bean
- class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping" />
- <!-- HandlerAdapter -->
- <bean
- class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" />
- <!-- ViewResolver -->
- <bean
- class="org.springframework.web.servlet.view.InternalResourceViewResolver">
- <property name="viewClass"
- value="org.springframework.web.servlet.view.JstlView" />
- <property name="prefix" value="/WEB-INF/jsp/" />
- <property name="suffix" value=".jsp" />
- </bean>
- <mvc:annotation-driven />
- <!-- 处理器 -->
- <!-- <bean name="/hello" class="com.mvc.jn.controller.HelloWorldController"/> -->
- <context:component-scan base-package="com"/>
- </beans>
controller 的目录结构如下:
(2)这个问题解决之后,又报错:
No mapping found for HTTP request with URI [/exam3/WEB-INF/jsp/welcome.jsp] in DispatcherServlet with name 'spring2'
结果发现是web.xml配置得有问题,下面是有问题的:
- <servlet>
- <servlet-name>spring2</servlet-name>
- <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>spring2</servlet-name>
- <url-pattern>/*</url-pattern>
- </servlet-mapping>
解决方法:把url-pattern 由/* 改为/
springmvc No mapping found for HTTP request with URI in Dispatc的更多相关文章
- springMVC No mapping found for HTTP request with URI
转载自:http://blog.sina.com.cn/s/blog_534f69a00101332u.html 1.问题: No mapping found for HTTP request wit ...
- 【错误信息】springMVC No mapping found for HTTP request with URI
出现这个问题的原因是在web.xml中配置错了:
- 相对路径获取项目文件 及报错 No mapping found for HTTP request with URI XXX in DispatcherServlet with name ‘springmvc’解决方法
首先一点,WebRoot目录下的文件是都可以通过浏览器输入路径,直接读取到的 例如这样: 而WebRoot下面WEB-INF是无法浏览器输入路径直接读取的. 因为是受保护的. 如果jsp读取一个图片的 ...
- No mapping found for HTTP request with URI [/crmcrmcrm/css/bootstrap.min.css] in DispatcherServlet with name 'springMvc'
先把错误贴上来 No mapping found for HTTP request with URI [/crmcrmcrm/css/sb-admin-2.css] in DispatcherServ ...
- Servlet3模块化应用中,@Controller没有被注入,导致出现:No mapping found for HTTP request with URI [/xxx/xxx] in DispatcherServlet with name 'springmvc'
问题描述:Servlet3模块化应用中,@Controller没有被注入,导致出现: org.springframework.web.servlet.DispatcherServlet noHandl ...
- 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 ...
- '/'和‘/*’差异造成的No mapping found for HTTP request with URI [/springMVC/welcome.jsp] in DispatcherServlet with name 'springmvc'
在采用springMVC框架的时候所遇到的一个小问题,其中web.xml中关于servlet的配置如下: <servlet> <servlet-name>springmvc&l ...
- SpringMvc出现No mapping found for HTTP request with URI的终极解决办法
No mapping found for HTTP request with URI 出现这个问题的原因是在web.xml中配置错了,如: <servlet> <servlet-na ...
- 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 ...
随机推荐
- 解决 Gnome3 窗口背景是黑色的问题
. . . . . Gnome3 在 Ubuntu 上窗口背景颜色经常是黑色的,终于找到了解决办法,其实很简单: >$ gsettings set com.canonical.desktop.i ...
- 转:Unknown module(s) in QT: multimedia
在编写串口时遇到了以下问题:Unknown module(s) in QT: multimedia 在ubuntu中解决方法如下: qtmultimedia5-de sudo apt-get inst ...
- oc 单例
单例模式: //static id _instace; // //+ (id)allocWithZone:(struct _NSZone *)zone //{ // static dispatch_o ...
- 使用visio 2007对现有的数据库进行反向工程
假如你有一个数据库并且想对这个数据库进行ER图的描绘:又或者你想绘制一个ER图,但发觉绘制效率太低,对visio不熟悉,而你对数据库的操作却了如指掌.这时候你可以利用Visio的反向工程对已有的数据库 ...
- atoi()函数
原型:int atoi (const char *nptr) 用法:#include <stdlib.h> 功能:将字符串转换成整型数:atoi()会扫描参数nptr字符串,跳过前 ...
- 08JAVA多态
//我并没有用多态,因为我也不知道怎么用多态实现ATM操作流程/* * 模拟ATM机 * 徐浩军 20153153 */ package 中转; import java.util.Scanner; p ...
- WKwebView与JS交互(h5主动)
先:WKUIDelegate,WKNavigationDelegate,WKScriptMessageHandler // 创建一个webiview的配置项 WKWebViewConfiguratio ...
- 中国能用的NTP服务器地址
133.100.11.8 prefer210.72.145.44203.117.180.36131.107.1.10time.asia.apple.com64.236.96.53130.149.17. ...
- 20151214study
An important quality of steel is its strength. (1)钢铁的最重要品质是其强度.She made a quick decision.她做了一个很快的决定. ...
- win8 vs2010 openni2 配置
打开一个新项目或者已存在的项目用以使用 OpenNI 在Visual Studio 菜单中, 打开项目菜单,选择项目属性. 在C/C++ 选项卡中, 在"常规" 下, 选择 &q ...