2.创建两个配置文件 struts.xml ,applicationContext.xml
3.在web.xml文件中添加第一个 spring监听 (spring-web) 第二部分 struts2过滤器(contextConfigLocation是配置applicationContext.xml路径,不写我们可以将它复制放在WEB-INF文件夹下)
4.写xml登录页面(success.jsp与error.jsp就不在这里写了);写action(继承 ActionSupport)
5.实例化action(在applicationContext.xml中)
<bean id="loginAction" class="org.hp.action.LoginAction"></bean>
6. 修改struts.xml配置(class调用applicationContext.xml中class对应的id)
<struts>
<package name="struts" namespace="/" extends="struts-default">
<action name="dologin" class="loginAction" method="login">
<result name="success">success.jsp</result>
<result name="error">error.jsp</result>
</action>
</package>
</struts>
总结:到此我们就完成了Struts2与Spring的简单整合,实现登录的demo效果!!!