`

struts2-2.2.1 spring2.5.6 整合

阅读更多

 

依赖jar包

commons-fileupload-1.2.1.jar

commons-io-1.3.2.jar 

commons-logging-1.1.jar 
freemarker-2.3.16.jar 

javassist-3.9.0.GA.jar
ognl-3.0.jar 
struts2-core-2.2.1.jar 

struts2-spring-plugin-2.2.1.jar
xwork-core-2.2.1.jar 

spring.jar

 

web.xml部分配置:

 

<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>classpath:config/spring_gloable.xml</param-value>
	</context-param>

    <filter>
		<filter-name>struts2.2.1</filter-name>
		<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
	</filter>

	<filter-mapping>
		<filter-name>struts2.2.1</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>

 struts.xml:

 

<!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
        "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
	<constant name="struts.objectFactory" value="spring" />
	<include file="struts-default.xml"></include>
	<package name="portal" extends="struts-default">  
        <action name="test" class="test" method="test">  
            <result>/test.jsp</result>  
        </action>  
    </package> 
</struts>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics