配置xml时一些jar和命名空间问题,如mvc:annotation-driven
暑假用springmvc搭了一些小demo,刚开始和以前搭建ssh一样,出现了一些jar未加载和xml文件的命名空间没引入的问题。想想每次都是出了问题去网上百度,有点烦,就记下来了。 Q1.元素 "mvc:annotation-driven" 的前缀 "mvc"未绑定 办法:这是我在spring-servlet.xml文件里使用<mvc>开头的标签时,忘记引入了命名空间。在xml的beans里面加入如下代码即可 xmlns:mvc="http://www.springframework.org/schema/mvc" http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
Q2.元素 "context:component-scan" 的前缀 "context"未绑定 办法:同样的原因,引入即可 xmlns:context="http://www.springframework.org/schema/context" http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd (注意:spring的命名空间如果不加入版本号,比如spring-mvc-3.0.xsd去掉3.0版本号,就默认是最新的版本,在myeclipse里面可以按住CTRL键跟进去,查看具体的版本信息)
Q3.java.lang.ClassNotFoundException: org.springframework.dao.support.DaoSupport 办法:缺少spring-tx.jar,引入即可
Q4.PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'dataSource 办法:配置dao之后出现的问题,原因是缺少spring-jdbc包,引入即可 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- 你如何用pg gemfile和Rails 3.1修复这个Heroku错误?
- c# – 如何在Xamarin.forms中的CarouselPage中以编程方式更
- 依赖注入 – 在xunit中实例化IOptions <>
- postgresql9.1.3的pg_log问题
- 使用C#.Net访问SQL Server数据库的最佳方式
- 在IAR下通过Jlink将程序直接下载到Flash指定地址
- ruby-on-rails-3 – 乘客Nginx显示自定义500页
- ruby-on-rails-3 – 使用Carrierwave的条件版本/过程
- 使用序列在表中插入值时,oracle 11.2.0.1.0和oracle 11.2.0
- PostgreSQL启动过程中的那些事十五:加载客户端认证文件