1, the existing project is through
<action path= "/aaaaaction"
Type= "Org.springframework.web.struts.DelegatingActionProxy"
Name= "Pldraftprlineform"
Scope= "Request"
Parameter= "Method"
Validate= "true" >
<forward name= "list" path= "/aaa.jsp"/>
<forward name= "batchsetting" path= "/bbb.jsp"/>
<forward name= "list" path= "/ccc.jsp"/>
<forward name= "edit" path= "/dddd.jsp"/>
<forward name= "Create" path= "/eeee" redirect= "true"/>
<forward name= "Delete" path= "/ffffff" redirect= "true"/>
</action>
<bean name= "/aaaaaction" class= "com. Aaaaction ">
<property name= "A" ref= "M/>
<property name= "B" ref= "E"/>
<property name= "C" ref= "F"/>
<property name= "D" ref= "G"/>
</bean>
Such an integrated
2, Delegatingactionproxy
in English
Delegate is a representative of a group (a representative of a community).
Proxy representative (on behalf of only one person) is the appointment of someone else to participate in (meeting/vote) Activities (or charges if the appointment of a business person).
Agent Brokers/agents (fees for the industry)
3, in Delegatingactionproxy
Package org.springframework.web.struts;
Import Javax.servlet.http.HttpServletRequest;
Import Javax.servlet.http.HttpServletResponse;
Import org.apache.struts.action.Action;
Import Org.apache.struts.action.ActionForm;
Import Org.apache.struts.action.ActionForward;
Import org.apache.struts.action.ActionMapping;
Import Org.apache.struts.action.ActionServlet;
Import Org.apache.struts.config.ModuleConfig;
Import org.springframework.beans.BeansException;
Import Org.springframework.web.context.WebApplicationContext;
/**
* Proxy for a spring-managed Struts <code>Action</code> that's defined in
* {@link contextloaderplugin contextloaderplugin ' s}
* {@link Webapplicationcontext}.
*
* <p>the proxy is defined in the Struts config file, specifying this
* Class as the action class. This class would delegate to a Struts
* <code>Action</code> Bean in the <code>ContextLoaderPlugIn</code> context.
*
* <pre class= "code" ><action path= "/login" type= "Org.springframework.web.struts.DelegatingActionProxy" /></pre>
*
* The name of the <code>Action</code> Bean in the
* <code>WebApplicationContext</code> 'll is determined from the mapping
* Path and module prefix. This can is customized by overriding the
* <code>determineActionBeanName</code> method.
*
* <p>example:
* <ul>
* <li>mapping path "/login", Bean name "/login" <br>
* <li>mapping path "/login", module prefix "/mymodule",
* Bean name "/mymodule/login"
* </ul>
*
* <p>a corresponding bean definition in the <code>ContextLoaderPlugin</code>
* Context would look as follows; Notice that the <code>Action</code> are now
* Able to leverage fully Spring ' s configuration facilities:
*
* <pre class= "code" >
* <bean name= "/login" class= "MyApp. Myaction ">
* <property name= "..." >...</property>
* </bean></pre>
*
* Note that the can use a single <code>ContextLoaderPlugIn</code> for all
* Struts modules. That context can in turn is loaded from multiple XML files,
* For example split according to Struts modules. Alternatively, define one
* <code>ContextLoaderPlugIn</code> per Struts module, specifying appropriate
* "Contextconfiglocation" parameters. In both cases, the Spring bean name
* Have to include the module prefix.
*
* <p>if want to avoid have to specify <code>DelegatingActionProxy</code>
* As the <code>Action</code> type in your Struts-config file (for example to
* be able to generate your Struts config file with XDoclet) consider using the
* {@link delegatingrequestprocessor delegatingrequestprocessor}.
* The latter ' s disadvantage is the it might conflict with the need
* For a different <code>RequestProcessor</code> subclass.
*
* <p>the default implementation delegates to the {@link delegatingactionutils}
* Class as much as possible, to reuse as much code as possible with
* <code>DelegatingRequestProcessor</code> and
* {@link delegatingtilesrequestprocessor}.
*
* <p>note:the idea of delegating to spring-managed Struts Actions originated in
* Don Brown ' s <a href= "http://struts.sourceforge.net/struts-spring" >spring struts plugin</a>.
* <code>ContextLoaderPlugIn</code> <code>DelegatingActionProxy</code>
* Constitute a clean-room implementation of the same idea, essentially
* Superseding the original plugin. Many thanks to Don Brown and Matt raible
* For the original, the agreement to Reimplement
* Spring proper!
*
* @author Juergen Hoeller
* @since 1.0.1
* @see #determineActionBeanName
* @see Delegatingrequestprocessor
* @see Delegatingtilesrequestprocessor
* @see Delegatingactionutils
* @see Contextloaderplugin
* @deprecated as of Spring 3.0
*/
@Deprecated
public class Delegatingactionproxy extends Action {
/**
* Pass the Execute call on to the spring-managed delegate <code>action</code>.
* @see #getDelegateAction
*/
@Override
Public Actionforward Execute (
actionmapping mapping, Actionform form, httpservletrequest request, httpservletresponse response)
Throws Exception {
Action delegateaction = getdelegateaction (mapping);
return Delegateaction.execute (mapping, form, request, response);
}
/**
* Return the delegate <code>Action</code> for the given <code>mapping</code>.
* <p>the default implementation determines a bean name from the
* Given <code>ActionMapping</code> looks up the corresponding beans in
* The {@link webapplicationcontext}.
* @param mapping the Struts <code>ActionMapping</code>
* @return The delegate <code>Action</code>
* @throws beansexception if thrown by <code>WebApplicationContext</code> methods
* @see #determineActionBeanName
*/
Protected Action getdelegateaction (actionmapping mapping) throws Beansexception {
Webapplicationcontext WAC = Getwebapplicationcontext (Getservlet (), Mapping.getmoduleconfig ());
String beanname = determineactionbeanname (mapping);
Return (Action) Wac.getbean (Beanname, Action.class);
}
/**
* Fetch Contextloaderplugin ' s {@link webapplicationcontext} from the
* <CODE>SERVLETCONTEXT</CODE>, falling back to the root
* <CODE>WEBAPPLICATIONCONTEXT</CODE>.
* <p>this context is supposed to contain the Struts <code>Action</code>
* Beans to delegate.
* @param actionservlet The associated <code>ActionServlet</code>
* @param moduleconfig The associated <code>ModuleConfig</code>
* @return The <code>WebApplicationContext</code>
* @throws illegalstateexception If no <code>WebApplicationContext</code> could be found
* @see Delegatingactionutils#findrequiredwebapplicationcontext
* @see Contextloaderplugin#servlet_context_prefix
*/
Protected Webapplicationcontext Getwebapplicationcontext (
Actionservlet Actionservlet, Moduleconfig moduleconfig) throws IllegalStateException {
Return Delegatingactionutils.findrequiredwebapplicationcontext (Actionservlet, moduleconfig);
}
/**
* Determine the name of the <code>Action</code> Bean, to is looked up in
* the <code>webapplicationcontext</code>.
* <p>the default implementation takes the
* {@link Org.apache.struts.action.actionmapping#getpath mapping path} and
* Prepends the
* {@link org.apache.struts.config.moduleconfig#getprefix module prefix},
* If any.
* @param mapping the Struts <code>ActionMapping</code>
* @return The name of the Action Bean
* @see Delegatingactionutils#determineactionbeanname
* @see Org.apache.struts.action.actionmapping#getpath
* @see Org.apache.struts.config.moduleconfig#getprefix
*/
Protected String Determineactionbeanname (actionmapping mapping) {
return Delegatingactionutils.determineactionbeanname (mapping);
}
}
Integration of spring Learning notes struts