Class StrutsContext

java.lang.Object
org.apache.struts.faces.util.StrutsContext

public class StrutsContext extends Object
Context bean providing accessors for the Struts related request, session, and application scope objects related to this request. Note that this bean's methods will trigger exceptions unless there is a FacesContext instance for this request.
  • Constructor Details

    • StrutsContext

      public StrutsContext()
      Creates a new instance with FacesContext.getCurrentInstance().
    • StrutsContext

      public StrutsContext(FacesContext facesContext)
      Create a new instance with give FacesContext.
      Parameters:
      facesContext - The give FacesContext
  • Method Details

    • getActionEvent

      public ActionEvent getActionEvent()
      Return the ActionEvent for the current request (if any).
    • getActionMapping

      public ActionMapping getActionMapping()
      Return the ActionMapping for the current request (if any).
    • getActionMessages

      public ActionMessages getActionMessages()
      Return the ActionMessages instance containing application error messages for this request (if any).
    • getActionServlet

      public ActionServlet getActionServlet()
      Return the ActionServlet instance for this web application.
    • isCancelled

      public boolean isCancelled()
      Return true if a Boolean true value has been stored in the request attribute indicating that this request has been cancelled.
    • getException

      public Throwable getException()
      Return the exception that caused one of the Struts custom tags to report a JspException (if any).
    • getExternalContext

      public ExternalContext getExternalContext()
      Return the ExternalContext for the current request.
    • getFacesContext

      public FacesContext getFacesContext()
      Return the FacesContext for the current request.
    • getLocale

      public Locale getLocale()
      Return the Locale stored in the current user's session (if any) for Struts based localization.
    • getMessageResources

      public MessageResources getMessageResources()
      Return the MessageResources instance for the application module that is processing this request (if any).
    • getModuleConfig

      public ModuleConfig getModuleConfig()
      Return the ModuleConfig for the application module to which this request has been assigned (if any).
      Returns:
      the ModuleConfig for the application module
      Throws:
      IllegalArgumentException - if no ModuleConfig can be found
    • getModuleConfig

      public static ModuleConfig getModuleConfig(FacesContext facesContext)
      Return the ModuleConfig for the application module to which this request has been assigned (if any).
      Parameters:
      facesContext - The given FacesContext
      Returns:
      the ModuleConfig for the application module
      Throws:
      IllegalArgumentException - if no ModuleConfig can be found
    • getModuleConfig

      public static ModuleConfig getModuleConfig(ExternalContext externalContext)
      Return the ModuleConfig for the application module to which this request has been assigned (if any).
      Parameters:
      externalContext - The given ExternalContext
      Returns:
      the ModuleConfig for the application module
      Throws:
      IllegalArgumentException - if no ModuleConfig can be found
    • uri

      public static String uri(FacesContext context)
      Return the absolute URI to be rendered as the value of the href attribute.
      Parameters:
      context - FacesContext for the current request
      Throws:
      IllegalArgumentException - Request is neither HttpServletRequest nor PortletRequest.