SpringMVC配置servlet.xml的时候出现的问题
2012-12-24 12:37
309 查看
今天我们学了SpringMVC,老师给我们粘贴了[servlet-name]-servlet.xml文件的头部,即:
<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:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
在启动服务器的时候,有的时候会开启服务器成功,有的时候就会报错,意思是找不到: <mvc:annotation-driven/>
当然,偶尔又不报错,可以正常运行。
在网上我查这种问题,没有人遇到,在群里问,也没有人遇到,挺愁人的,后来我在网上又找到了一个版本的[servlet-name]-servlet.xml的头部文件,最终解决了问题,即:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
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.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<!-- 默认的注解映射的支持 -->
<mvc:annotation-driven/>
<!-- 自动扫描的包名 -->
<context:component-scan base-package="com.springmvc1.controder"></context:component-scan>
希望能够给大家带来帮助
本文出自 “白手起家” 博客,请务必保留此出处http://zhangshuoyin.blog.51cto.com/3305760/1098087
<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:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
在启动服务器的时候,有的时候会开启服务器成功,有的时候就会报错,意思是找不到: <mvc:annotation-driven/>
当然,偶尔又不报错,可以正常运行。
在网上我查这种问题,没有人遇到,在群里问,也没有人遇到,挺愁人的,后来我在网上又找到了一个版本的[servlet-name]-servlet.xml的头部文件,最终解决了问题,即:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
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.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<!-- 默认的注解映射的支持 -->
<mvc:annotation-driven/>
<!-- 自动扫描的包名 -->
<context:component-scan base-package="com.springmvc1.controder"></context:component-scan>
希望能够给大家带来帮助
本文出自 “白手起家” 博客,请务必保留此出处http://zhangshuoyin.blog.51cto.com/3305760/1098087
相关文章推荐
- 使用SpringMVC时添加了web.xml中的DispatchServlet配置后出现Tomcat服务器无法启动的问题
- JSP学习笔记之三——关于servlet配置web.xml出现的问题
- Spring Mvc 配置web.xml中的servlet-mapping时遇到的问题
- 已经配置了context-param还是出现Could not open ServletContext resource [/WEB-INF/applicationContext.xml]
- 在配置dubbo框架的时候出现dubbo:application标签无法识别问题。
- springMVC的web.xml配置DispatcherServlet中Allocate exception for servlet DispatcherServlet异常处理
- SpringMVC项目中配置xml时一些和命名空间相关的问题,如mvc:annotation-driven的前缀 "mvc"未绑定
- springMVC-servlet.xml 配置
- SpringMVC的XX-servlet.xml的配置
- 关于spring和springmvc的xml自动扫描配置问题
- eclipse 中新建的Dynamic Web Project 中无web.xml&&web.xml中Servlet的配置问题
- 【SpringMVC之配置文件(一)】spring 里面的ApplicationContext.xml 和 xxx-servlet.xml分别的作用是什么?
- springmvc-servlet.xml(springmvc-servlet.xml 配置 增强配置)
- SpringMVC-DispatcherServlet配置(Spring-servlet.xml)
- SpringMVC spring-servlet.xml配置
- spring mvc写XML的时候出现过的问题
- Maven项目配置spring时 出现Could not open ServletContext resource [/WEB-INF/applicationContext.xml]解决方案
- 需要解决post提交数据的时候,乱码的问题:在web.xml里做配置:
- Servlet 在 web.xml 中设置<init-param>配置信息遇到的问题
- 关于ssh 框架 applicationContext.xml文件中配置hibernate数据库出现的一个小问题