1.主要让spring生成Action供struts使用
2.导入jar包struts2-spring-plugin-2.5.10.jar
struts2配置
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
<struts>
<package name="ssh" extends="struts-default" namespace="/">
<!-- 使用通配符 需要添加属性method = -->
<action name="TestAction_*" class="testAction" method="{1}">
<result name="success">/login.jsp</result>
</action>
</package>
</struts>
spring配置
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean name="testAction" class="com.chet.action.TestAction"></bean>
</beans>

本文介绍了如何将Struts2与Spring框架进行集成,通过配置实现了Action的管理和调用。主要内容包括导入必要的jar包、配置Struts2和Spring的具体设置等。
948

被折叠的 条评论
为什么被折叠?



