Strut2+Spring整合框架搭建
参考:http://lukuijun.iteye.com/blog/350750
以下为我自己整理的步骤:
?
Struts2和Spring整合,创建一个web项目TestSS
1、整合struts2
1)导入strut2的jar包:
commons-logging-1.0.4.jar,
freemarker-2.3.8.jar,
ognl-2.6.11.jar,
struts2-core-2.0.12.jar,
xwork-2.06.jar,
javassist-3.11.0.GA.jar,
commons-fileupload-1.2.2.jar
commons-lang-2.5.jar。暂时导入这些jar包,到时候需要再导入。
2)将struts.xml文件放置在TestSS工程的src目录下。
?5)可以在web-inf下加入log4j的lib,在web.xml配置如下:
?success.jsp
?web.xml
?struts.xml
?User类
package com.test.dao.impl;import com.test.dao.LoginDao;public class LoginDaoImpl implements LoginDao{public boolean isValid() {return true;}}?运行tomcat启动:http://localhost:8080/TestSS/login.jsp
输入用户名和密码,点提交后后台打印出
user----
is valid user