日期:2014-05-16  浏览次数:20688 次

springmvc整合mybatis,mysql
开发环境:

System:Windows

WebBrowser:IE6+、Firefox3+

JavaEE Server:tomcat5.0.2.8、tomcat6

IDE:eclipse、MyEclipse 8

Database:MySQL

开发依赖库:

JavaEE5、Spring 3.0.5、Mybatis 3.0.4、myBatis-spring-1.0、junit4.8.2

Email:hoojo_@126.com

?

1、 首先新建一个WebProject 命名为MyBatisForSpring,新建项目时,使用JavaEE5的lib库。然后手动添加需要的jar包,所需jar包如下:

clip_image002

2、 添加spring的监听及springMVC的核心Servlet,web.xml内容,内容如下:

<-- 加载Spring容器配置 -->
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListenerlistener-class>
listener>
?
<-- 设置Spring容器加载配置文件路径 -->
<context-param>
    <param-name>contextConfigLocation