关于整合其实简单的要命的事情,暂时只掌握到struts整合的一种方式;
简单说就是代理Action:
步骤:
1.导入包--struts2-spring-plugin-2.0.11
2.以及web.xml设置spring的listener:
3.建立applicationContext.xml,不过存放位置不同哦,是WEB-INF包下,不是以前的位置了;
4.struts.xml设置:
另外,applicationContext.xml的位置是可以在web.xml配置的;
简单说就是代理Action:
步骤:
1.导入包--struts2-spring-plugin-2.0.11
2.以及web.xml设置spring的listener:
- <listener>
- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
- </listener>
3.建立applicationContext.xml,不过存放位置不同哦,是WEB-INF包下,不是以前的位置了;
- <bean id="user_action" class="com.wang.action.User_Action" scope="prototype">
- //id代理的action名字
- ......
4.struts.xml设置:
- <action name="login" class="user_action">
- //class是代理action
另外,applicationContext.xml的位置是可以在web.xml配置的;
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>classpath*:applicationContext.xml</param-value>
- //配置位置,此处配置是指src下
- </context-param>
- <listener>
- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
- </listener>