2008-05-29

Spring整合Struts1.x

关键字: ssh development

最近学习SSH

先搞清楚Spring如何整合Struts进行开发

具体细节不详细说明了

主要过程包括:

1。装载Spring context

2。整合Struts

具体如下:

1。装载Spring context 的方法主要有两种:

(1)在struts-config.xml中配置

....................................

   <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">

            <set-property peperpty="contextConfigLocation" value="/WEB-INF/classes/applicationContext.xml"/>

</plug-in>

...................................

(2)在web.xml中配置

...............................................................................

<context-param>

   <param-name>contextConfigLocation</param-name>

   <param-class>/WEB-INF/classes/applicationContext.xml</param-class>

</context-param>

<servlet>

   <servlet-name>context</servlet-name>

   <servlet-class>org.springframework.web.context.classLoaderServlet</servlet-class>

   <load-on-startup>1</load-on-startup>

</servlet>

 2。整合Struts方法主要有3种:

(1)用户Action直接继承ActionSupport类,调用getWebApplicationContext().getBean()方法注入所需要的类.

(2)使用Spring的DelegationRequestProcessor代替ActionServlet.

(3)使用Spring的委托代理.

 具体过程暂时未写...:)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

评论
发表评论

提醒: 该博客已发表在公共论坛,博客所有留言会成为论坛回贴,留言请注意遵守论坛发贴规则

您还没有登录,请登录后发表评论

chen-516888
搜索本博客
博客分类
我的相册
1a8a55a2-8a9d-35ea-bba5-9d7fc566e002-thumb
IMG_9122
共 1 张
最近加入圈子
存档
最新评论