org.springframework.web.struts

## Class LookupDispatchActionSupport

- java.lang.Object
- - org.apache.struts.action.Action
  - - org.apache.struts.actions.DispatchAction
    - - org.apache.struts.actions.LookupDispatchAction
      - - org.springframework.web.struts.LookupDispatchActionSupport

- Deprecated.
  as of Spring 3.0

      @Deprecated
      public abstract class LookupDispatchActionSupport
      extends org.apache.struts.actions.LookupDispatchAction

  Convenience class for Spring-aware Struts 1.1+ LookupDispatchActions.

  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 MappingDispatchActions, use the analogous `ActionSupport` or `DispatchActionSupport` / `MappingDispatchActionSupport` 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`.

  Since:
    1.1
  Author:
    Juergen Hoeller
  See Also:
    `ContextLoaderPlugIn.SERVLET_CONTEXT_PREFIX`, `WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE`, `ContextLoaderListener`, `ActionSupport`, `DispatchActionSupport`, `MappingDispatchActionSupport`, `DelegatingActionProxy`, `DelegatingRequestProcessor`

- - ### Field Summary

    - ### Fields inherited from class org.apache.struts.actions.LookupDispatchAction

      `keyMethodMap, localeMap`

    - ### Fields inherited from class org.apache.struts.actions.DispatchAction

      `clazz, log, messages, methods, types`

    - ### Fields inherited from class org.apache.struts.action.Action

      `defaultLocale, servlet`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LookupDispatchActionSupport()` Deprecated.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected MessageSourceAccessor` | `getMessageSourceAccessor()` Deprecated. Return a MessageSourceAccessor for the application context used by this object, for easy message access.
    `protected ServletContext` | `getServletContext()` Deprecated. Return the current ServletContext.
    `protected File` | `getTempDir()` Deprecated. Return the temporary directory for the current web application, as provided by the servlet container.
    `protected WebApplicationContext` | `getWebApplicationContext()` Deprecated. Return the current Spring WebApplicationContext.
    `protected WebApplicationContext` | `initWebApplicationContext(org.apache.struts.action.ActionServlet actionServlet)` Deprecated. Fetch ContextLoaderPlugIn's WebApplicationContext from the ServletContext, falling back to the root WebApplicationContext (the usual case).
    `protected void` | `onDestroy()` Deprecated. Callback for custom destruction when the ActionServlet shuts down.
    `protected void` | `onInit()` Deprecated. Callback for custom initialization after the context has been set up.
    `void` | `setServlet(org.apache.struts.action.ActionServlet actionServlet)` Deprecated. Initialize the WebApplicationContext for this Action.

    - ### Methods inherited from class org.apache.struts.actions.LookupDispatchAction

      `execute, getKeyMethodMap, getLookupMapName, getMethodName`

    - ### Methods inherited from class org.apache.struts.actions.DispatchAction

      `cancelled, dispatchMethod, getMethod, getParameter, unspecified`

    - ### 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, 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

    - #### LookupDispatchActionSupport

          public LookupDispatchActionSupport()

      Deprecated.

  - ### Method Detail

    - #### setServlet

          public void setServlet(org.apache.struts.action.ActionServlet actionServlet)

      Deprecated.
      Initialize the WebApplicationContext for this Action. Invokes onInit after successful initialization of the context.
      Overrides:
        `setServlet` in class `org.apache.struts.action.Action`
      See Also:
        `initWebApplicationContext(org.apache.struts.action.ActionServlet)`, `onInit()`

    - #### initWebApplicationContext

          protected WebApplicationContext initWebApplicationContext(org.apache.struts.action.ActionServlet actionServlet)
                                                             throws IllegalStateException

      Deprecated.
      Fetch ContextLoaderPlugIn's WebApplicationContext from the ServletContext, falling back to the root WebApplicationContext (the usual case).
      Parameters:
        `actionServlet` - the associated ActionServlet
      Returns:
        the WebApplicationContext
      Throws:
        `IllegalStateException` - if no WebApplicationContext could be found
      See Also:
        `DelegatingActionUtils.findRequiredWebApplicationContext(org.apache.struts.action.ActionServlet, org.apache.struts.config.ModuleConfig)`

    - #### getWebApplicationContext

          protected final WebApplicationContext getWebApplicationContext()

      Deprecated.
      Return the current Spring WebApplicationContext.

    - #### getMessageSourceAccessor

          protected final MessageSourceAccessor getMessageSourceAccessor()

      Deprecated.
      Return a MessageSourceAccessor for the application context used by this object, for easy message access.

    - #### getServletContext

          protected final ServletContext getServletContext()

      Deprecated.
      Return the current ServletContext.

    - #### getTempDir

          protected final File getTempDir()

      Deprecated.
      Return the temporary directory for the current web application, as provided by the servlet container.
      Returns:
        the File representing the temporary directory

    - #### onInit

          protected void onInit()

      Deprecated.
      Callback for custom initialization after the context has been set up.
      See Also:
        `setServlet(org.apache.struts.action.ActionServlet)`

    - #### onDestroy

          protected void onDestroy()

      Deprecated.
      Callback for custom destruction when the ActionServlet shuts down.
      See Also:
        `setServlet(org.apache.struts.action.ActionServlet)`