Perfect Finish!
Demo:Simple Login
WIN7 32bit +MySQL5.6
SpringMVC + MyBatis
jar:
1.驱动:mysql-connector-java-5.1.7-bin.jar
2.jstl 的
jstl.jar
standard.jar
3.spring 的
spring-aop-4.0.0.M2.jar
spring-beans-4.0.0.M2.jar
spring-context-4.0.0.M2.jar
spring-core-4.0.0.M2.jar (若出现问题,可以替换 spring-core-4.0.0.RELEASE.jar)
spring-expression-4.0.0.M2.jar
spring-jdbc-4.0.0.M2.jar
spring-test-4.0.0.M2.jar
spring-tx-4.0.0.M2.jar
4.mybatis 的
mybatis-3.1.1.jar
log4j-1.2.16.jar
mybatis-spring-1.2.1.jar
5.以及spring-depend
aopalliance-1.0.jar
cglib-nodep-2.1_3.jar
commons-logging-1.1.1.jar
6.web 相关的
spring-web-4.0.0.RELEASE.jar
spring-webmvc-4.0.0.RELEASE.jar
XML文件
1.Spring基本的ApplicationContext.xml 本例中用的是 beans_wolf.xml(名字一定要注意,尽量用前面的)
配置了:
<!-- 1. 数据源 : DriverManagerDataSource -->
<!-- 2. mybatis的SqlSession的工厂: SqlSessionFactoryBean
dataSource / typeAliasesPackage -->
<!-- 3. mybatis自动扫描加载Sql映射文件 : MapperScannerConfigurer
sqlSessionFactory / basePackage /configLocation-->
<!-- 4. 事务管理 : DataSourceTransactionManager -->
<!-- 5. 使用声明式事务 -->
其中配置了数据库的具体信息,所以不在另外用属性文件了!
2.Spring MVC 的 applicationContext-mvc.xml
配置了:自动扫描包,注解驱动,视图解析器
3.mybatis-config.xml 这个具体配置根据你的实际来弄!
4.web.xml
配置了:
<!-- needed for ContextLoaderListener -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:beans_wolf.xml</param-value>
</context-param>
<!-- Bootstraps the root web application context before servlet initialization -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- DispatcherServlet-->
<servlet>
<servlet-name>springDispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<!-- 配置 SpringMVC 配置文件的位置 -->
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext-mvc.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springDispatcherServlet</servlet-name>
<!-- 配置什么样的请求交由 SpringMVC 处理 -->
<url-pattern>*.action</url-pattern>
</servlet-mapping>
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
Demo_SpringMVC_MyBatis.zip (55个子文件)
Demo_SpringMVC_MyBatis
conf
mybatis-config.xml 594B
.project 1KB
Warning.txt 1KB
environment_jar.txt 3KB
WebContent
WEB-INF
lib
spring-tx-4.0.0.M2.jar 242KB
log4j-1.2.16.jar 470KB
mybatis-spring-1.2.1.jar 48KB
cglib-nodep-2.1_3.jar 317KB
spring-webmvc-4.0.0.RELEASE.jar 645KB
jstl.jar 20KB
spring-aop-4.0.0.M2.jar 340KB
spring-web-4.0.0.RELEASE.jar 646KB
spring-expression-4.0.0.M2.jar 199KB
commons-logging-1.1.1.jar 59KB
spring-jdbc-4.0.0.M2.jar 407KB
spring-core-4.0.0.RELEASE.jar 933KB
spring-test-4.0.0.M2.jar 420KB
aopalliance-1.0.jar 4KB
spring-beans-4.0.0.M2.jar 617KB
standard.jar 384KB
mysql-connector-java-5.1.7-bin.jar 693KB
spring-context-4.0.0.M2.jar 906KB
mybatis-3.1.1.jar 636KB
test
success.jsp 462B
fail.jsp 495B
login.jsp 734B
list.jsp 2KB
web.xml 1KB
index.jsp 58B
META-INF
MANIFEST.MF 39B
src
beans_wolf.xml 2KB
com
springmvc_mybatis
controller
UserController.java 1KB
mapper
UserMapper.java 424B
userMapper.xml 733B
test
TestSimpleMyBatis.java 1KB
bean
User.java 1KB
mybatis-config.xml 594B
applicationContext-mvc.xml 1KB
wolf.sql 478B
.settings
org.eclipse.wst.jsdt.ui.superType.container 49B
org.eclipse.wst.common.project.facet.core.xml 345B
org.eclipse.jdt.core.prefs 364B
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.wst.common.component 518B
.jsdtscope 503B
build
classes
beans_wolf.xml 2KB
com
springmvc_mybatis
controller
UserController.class 2KB
mapper
UserMapper.class 471B
userMapper.xml 733B
test
TestSimpleMyBatis.class 2KB
bean
User.class 2KB
mybatis-config.xml 594B
applicationContext-mvc.xml 1KB
mybatis-config.xml 604B
.classpath 912B
共 55 条
- 1
资源评论
- EricOnTheWayIT2015-04-07例子写的不错,很适合粗学者
我是一个小小菜鸟
- 粉丝: 1
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功