org.apache.struts2

## Class ServletActionContext

- java.lang.Object
- - org.apache.struts2.ServletActionContext

- All Implemented Interfaces:
    StrutsStatics

      public class ServletActionContext
      extends Object
      implements StrutsStatics

  Web-specific context information for actions. This class subclasses `ActionContext` which provides access to things like the action name, value stack, etc. This class adds access to web objects like servlet parameters, request attributes and things like the HTTP session.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `STRUTS_VALUESTACK_KEY`

    - ### Fields inherited from interface org.apache.struts2.StrutsStatics

      `ACTION_MAPPING, HTTP_REQUEST, HTTP_RESPONSE, PAGE_CONTEXT, SERVLET_CONTEXT, SERVLET_DISPATCHER, STRUTS_ACTION_TAG_INVOCATION, STRUTS_PORTLET_CONTEXT`

  - ### Method Summary

    All Methods Static Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static ActionContext` | `getActionContext()`
    `static ActionContext` | `getActionContext(javax.servlet.http.HttpServletRequest req)` Gets the current action context
    `static ActionMapping` | `getActionMapping()` Gets the action mapping for this context
    `static ActionContext` | `getContext()` Deprecated. Use `getActionContext()` instead
    `static javax.servlet.jsp.PageContext` | `getPageContext()` Returns the HTTP page context.
    `static javax.servlet.http.HttpServletRequest` | `getRequest()` Gets the HTTP servlet request object.
    `static javax.servlet.http.HttpServletResponse` | `getResponse()` Gets the HTTP servlet response object.
    `static javax.servlet.ServletContext` | `getServletContext()` Gets the servlet context.
    `static ValueStack` | `getValueStack(javax.servlet.http.HttpServletRequest req)` Gets the current value stack for this request
    `static void` | `setRequest(javax.servlet.http.HttpServletRequest request)` Sets the HTTP servlet request object.
    `static void` | `setResponse(javax.servlet.http.HttpServletResponse response)` Sets the HTTP servlet response object.
    `static void` | `setServletContext(javax.servlet.ServletContext servletContext)` Sets the current servlet context object

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### STRUTS_VALUESTACK_KEY

          public static final String STRUTS_VALUESTACK_KEY

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getActionContext

          public static ActionContext getActionContext(javax.servlet.http.HttpServletRequest req)

      Gets the current action context
      Parameters:
        `req` - The request
      Returns:
        The current action context

    - #### getContext

          @Deprecated
          public static ActionContext getContext()

      Deprecated. Use `getActionContext()` instead
      Do not use this method, use `getActionContext()`
      Returns:
        action context

    - #### getActionContext

          public static ActionContext getActionContext()

    - #### getValueStack

          public static ValueStack getValueStack(javax.servlet.http.HttpServletRequest req)

      Gets the current value stack for this request
      Parameters:
        `req` - The request
      Returns:
        The value stack

    - #### getActionMapping

          public static ActionMapping getActionMapping()

      Gets the action mapping for this context
      Returns:
        The action mapping

    - #### getPageContext

          public static javax.servlet.jsp.PageContext getPageContext()

      Returns the HTTP page context.
      Returns:
        the HTTP page context.

    - #### setRequest

          public static void setRequest(javax.servlet.http.HttpServletRequest request)

      Sets the HTTP servlet request object.
      Parameters:
        `request` - the HTTP servlet request object.

    - #### getRequest

          public static javax.servlet.http.HttpServletRequest getRequest()

      Gets the HTTP servlet request object.
      Returns:
        the HTTP servlet request object.

    - #### setResponse

          public static void setResponse(javax.servlet.http.HttpServletResponse response)

      Sets the HTTP servlet response object.
      Parameters:
        `response` - the HTTP servlet response object.

    - #### getResponse

          public static javax.servlet.http.HttpServletResponse getResponse()

      Gets the HTTP servlet response object.
      Returns:
        the HTTP servlet response object.

    - #### getServletContext

          public static javax.servlet.ServletContext getServletContext()

      Gets the servlet context.
      Returns:
        the servlet context.

    - #### setServletContext

          public static void setServletContext(javax.servlet.ServletContext servletContext)

      Sets the current servlet context object
      Parameters:
        `servletContext` - The servlet context to use

Copyright © 2000–2024 Apache Software Foundation. All rights reserved.