Class WebApplicationContextFacesELResolver

java.lang.Object
jakarta.el.ELResolver
org.springframework.web.jsf.el.WebApplicationContextFacesELResolver

public class WebApplicationContextFacesELResolver extends jakarta.el.ELResolver
Special JSF ELResolver that exposes the Spring WebApplicationContext instance under a variable named "webApplicationContext".

In contrast to SpringBeanFacesELResolver, this ELResolver variant does not resolve JSF variable names as Spring bean names. It rather exposes Spring's root WebApplicationContext itself under a special name, and is able to resolve "webApplicationContext.mySpringManagedBusinessObject" dereferences to Spring-defined beans in that application context.

Configure this resolver in your faces-config.xml file as follows:

<application>
  ...
  <el-resolver>org.springframework.web.jsf.el.WebApplicationContextFacesELResolver</el-resolver>
</application>
Since:
2.5
Author:
Juergen Hoeller
See Also:
  • Field Details

    • WEB_APPLICATION_CONTEXT_VARIABLE_NAME

      public static final String WEB_APPLICATION_CONTEXT_VARIABLE_NAME
      Name of the exposed WebApplicationContext variable: "webApplicationContext".
      See Also:
    • logger

      protected final org.apache.commons.logging.Log logger
      Logger available to subclasses.
  • Constructor Details

    • WebApplicationContextFacesELResolver

      public WebApplicationContextFacesELResolver()
  • Method Details

    • getValue

      public @Nullable Object getValue(jakarta.el.ELContext elContext, @Nullable Object base, Object property) throws jakarta.el.ELException
      Specified by:
      getValue in class jakarta.el.ELResolver
      Throws:
      jakarta.el.ELException
    • getType

      public @Nullable Class<?> getType(jakarta.el.ELContext elContext, @Nullable Object base, Object property) throws jakarta.el.ELException
      Specified by:
      getType in class jakarta.el.ELResolver
      Throws:
      jakarta.el.ELException
    • setValue

      public void setValue(jakarta.el.ELContext elContext, Object base, Object property, Object value) throws jakarta.el.ELException
      Specified by:
      setValue in class jakarta.el.ELResolver
      Throws:
      jakarta.el.ELException
    • isReadOnly

      public boolean isReadOnly(jakarta.el.ELContext elContext, Object base, Object property) throws jakarta.el.ELException
      Specified by:
      isReadOnly in class jakarta.el.ELResolver
      Throws:
      jakarta.el.ELException
    • getCommonPropertyType

      public Class<?> getCommonPropertyType(jakarta.el.ELContext elContext, Object base)
      Specified by:
      getCommonPropertyType in class jakarta.el.ELResolver
    • getWebApplicationContext

      protected @Nullable WebApplicationContext getWebApplicationContext(jakarta.el.ELContext elContext)
      Retrieve the WebApplicationContext reference to expose.

      The default implementation delegates to FacesContextUtils, returning null if no WebApplicationContext found.

      Parameters:
      elContext - the current JSF ELContext
      Returns:
      the Spring web application context
      See Also: