struts2整合spring
struts2整合spring? 一个简单的登陆例子
1、创建web项目
2、导入struts2的jar包
?? commons-fileupload-1.2.1.jar
???commons-logging-1.0.4.jar
???freemarker-2.3.13.jar
???ognl-2.6.11.jar
???struts2-core-2.1.6.jar
???xwork-2.1.2.jar
3、创建类(action类、service接口、service接口的实现类)

4、在src下创建struts.xml文件? 用的其实是WEB-INF/classes/struts.xml
<struts>
??? <package name="ss" extends="struts-default">
??? ??? <action name="loginAction" scope="prototype">
??? ??? <property name="loginService" ref="loginService"></property>
??? </bean>
注意:这里的id --oginService要与loginAction中的一致(loginService作为loginAction中的一个属性,并设置set方法)
8、在WEB-INF/web.xml中配置spring信息
??? <context-param>
??? ??? <param-name>contextConfigLocation</param-name>
??? ??? <param-value>
??? ??? ??? /WEB-INF/classes/applicationContext.xml
??? ??? </param-value>
??? </context-param>
??? <listener>
??? ??? <listener-class>
??? ??? ??? org.springframework.web.context.ContextLoaderListener?
??? ??? </listener-class>
??? </listener>
9、创建login.jsp提交表单? 启动到tomcat服务器测试