|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.struts.action.Action org.apache.struts.actions.DispatchAction org.apache.struts.actions.MappingDispatchAction org.springframework.web.struts.MappingDispatchActionSupport
Convenience class for Spring-aware Struts 1.2 MappingDispatchActions.
Provides a reference to the current Spring application context, e.g. for bean lookup or resource loading. Auto-detects a ContextLoaderPlugIn context, falling back to the root WebApplicationContext. For typical usage, i.e. accessing middle tier beans, use a root WebApplicationContext.
For classic Struts Actions, DispatchActions or LookupDispatchActions,
use the analogous ActionSupport
or
DispatchActionSupport
/
LookupDispatchActionSupport
class.
As an alternative approach, you can wire your Struts Actions themselves
as Spring beans, passing references to them via IoC rather than looking
up references in a programmatic fashion. Check out
DelegatingActionProxy
and
DelegatingRequestProcessor
.
ContextLoaderPlugIn.SERVLET_CONTEXT_PREFIX
,
WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
,
ContextLoaderListener
,
ContextLoaderServlet
,
ActionSupport
,
DispatchActionSupport
,
LookupDispatchActionSupport
,
DelegatingActionProxy
,
DelegatingRequestProcessor
Field Summary |
Fields inherited from class org.apache.struts.actions.DispatchAction |
clazz, messages, methods, types |
Fields inherited from class org.apache.struts.action.Action |
defaultLocale, servlet |
Constructor Summary | |
MappingDispatchActionSupport()
|
Method Summary | |
protected MessageSourceAccessor |
getMessageSourceAccessor()
Return a MessageSourceAccessor for the application context used by this object, for easy message access. |
protected ServletContext |
getServletContext()
Return the current ServletContext. |
protected File |
getTempDir()
Return the temporary directory for the current web application, as provided by the servlet container. |
protected WebApplicationContext |
getWebApplicationContext()
Return the current Spring WebApplicationContext. |
protected WebApplicationContext |
initWebApplicationContext(ActionServlet actionServlet)
Fetch ContextLoaderPlugIn's WebApplicationContext from the ServletContext, falling back to the root WebApplicationContext (the usual case). |
protected void |
onDestroy()
Callback for custom destruction when the ActionServlet shuts down. |
protected void |
onInit()
Callback for custom initialization after the context has been set up. |
void |
setServlet(ActionServlet actionServlet)
Initialize the WebApplicationContext for this Action. |
Methods inherited from class org.apache.struts.actions.MappingDispatchAction |
execute, getMethodName, unspecified |
Methods inherited from class org.apache.struts.actions.DispatchAction |
cancelled, dispatchMethod, getMethod |
Methods inherited from class org.apache.struts.action.Action |
addErrors, addMessages, execute, generateToken, getDataSource, getDataSource, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, saveErrors, saveMessages, saveMessages, saveToken, setLocale |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MappingDispatchActionSupport()
Method Detail |
public void setServlet(ActionServlet actionServlet)
initWebApplicationContext(org.apache.struts.action.ActionServlet)
,
onInit()
protected WebApplicationContext initWebApplicationContext(ActionServlet actionServlet) throws IllegalStateException
actionServlet
- the associated ActionServlet
IllegalStateException
- if no WebApplicationContext could be foundContextLoaderPlugIn.SERVLET_CONTEXT_PREFIX
,
WebApplicationContextUtils.getWebApplicationContext(javax.servlet.ServletContext)
protected final WebApplicationContext getWebApplicationContext()
protected final MessageSourceAccessor getMessageSourceAccessor()
protected final ServletContext getServletContext()
protected final File getTempDir()
protected void onInit()
setServlet(org.apache.struts.action.ActionServlet)
protected void onDestroy()
setServlet(org.apache.struts.action.ActionServlet)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |