|
From: Juergen H. <ju...@in...> - 2005-02-21 13:09:16
|
The setServlet() call should happen through the ContextLoaderPlugIn that the
Actions have been loaded with; there should also be a setServlet(null) call
on shutdown. This allows, for example, multiple DelegatingActionProxy
definition in struts-config to point to the same Spring-managed Action bean,
without repeated setServlet() calls on the same instance.
Are you maybe defining your Struts Actions in Spring's root application
context? I would strongly recommend defining them in a separate
ContextLoaderPlugIn contexts, which in turn can reference midle tier beans
in the root application context (because the ContextLoaderPlugIn context
will automatically be a child of the root context, with all beans in the
root context being visible).
Juergen
-----Original Message-----
From: spr...@li...
[mailto:spr...@li...]On Behalf
Of John Georgiadis
Sent: Sunday, February 20, 2005 8:50 PM
To: spr...@li...
Subject: [Springframework-developer] DelegatingActionProxy &
setServlet()
Hi,
Actions wrapped by DelegatingActionProxy never have their setServlet()
method called. Does the following patch make sense?
John
--- src/org/springframework/web/struts/DelegatingActionProxy.java.orig
2004-12-11 15:47:46.000000000 +0200
+++ src/org/springframework/web/struts/DelegatingActionProxy.java
2005-02-20 21:18:37.647013908 +0200
@@ -117,8 +117,10 @@
*/
protected Action getDelegateAction(ActionMapping mapping) throws
BeansException {
WebApplicationContext wac =
getWebApplicationContext(getServlet(), mapping.getModuleConfig());
- String beanName = determineActionBeanName(mapping);
- return (Action) wac.getBean(beanName, Action.class);
+ String beanName = determineActionBeanName(mapping);
+ Action action = (Action) wac.getBean(beanName,
Action.class);
+ action.setServlet(getServlet());
+ return action;
}
/**
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|