public class WebApplicationContextFacesELResolver extends ELResolver
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>
SpringBeanFacesELResolver
,
FacesContextUtils.getWebApplicationContext(javax.faces.context.FacesContext)
Modifier and Type | Field and Description |
---|---|
protected Log |
logger
Logger available to subclasses
|
static java.lang.String |
WEB_APPLICATION_CONTEXT_VARIABLE_NAME
Name of the exposed WebApplicationContext variable: "webApplicationContext".
|
RESOLVABLE_AT_DESIGN_TIME, TYPE
Constructor and Description |
---|
WebApplicationContextFacesELResolver() |
Modifier and Type | Method and Description |
---|---|
java.lang.Class<?> |
getCommonPropertyType(ELContext elContext,
java.lang.Object base) |
java.util.Iterator<java.beans.FeatureDescriptor> |
getFeatureDescriptors(ELContext elContext,
java.lang.Object base) |
java.lang.Class<?> |
getType(ELContext elContext,
java.lang.Object base,
java.lang.Object property) |
java.lang.Object |
getValue(ELContext elContext,
java.lang.Object base,
java.lang.Object property) |
protected WebApplicationContext |
getWebApplicationContext(ELContext elContext)
Retrieve the WebApplicationContext reference to expose.
|
boolean |
isReadOnly(ELContext elContext,
java.lang.Object base,
java.lang.Object property) |
void |
setValue(ELContext elContext,
java.lang.Object base,
java.lang.Object property,
java.lang.Object value) |
invoke
public static final java.lang.String WEB_APPLICATION_CONTEXT_VARIABLE_NAME
protected final Log logger
public WebApplicationContextFacesELResolver()
public java.lang.Object getValue(ELContext elContext, java.lang.Object base, java.lang.Object property) throws ELException
getValue
in class ELResolver
ELException
public java.lang.Class<?> getType(ELContext elContext, java.lang.Object base, java.lang.Object property) throws ELException
getType
in class ELResolver
ELException
public void setValue(ELContext elContext, java.lang.Object base, java.lang.Object property, java.lang.Object value) throws ELException
setValue
in class ELResolver
ELException
public boolean isReadOnly(ELContext elContext, java.lang.Object base, java.lang.Object property) throws ELException
isReadOnly
in class ELResolver
ELException
public java.util.Iterator<java.beans.FeatureDescriptor> getFeatureDescriptors(ELContext elContext, java.lang.Object base)
getFeatureDescriptors
in class ELResolver
public java.lang.Class<?> getCommonPropertyType(ELContext elContext, java.lang.Object base)
getCommonPropertyType
in class ELResolver
protected WebApplicationContext getWebApplicationContext(ELContext elContext)
The default implementation delegates to FacesContextUtils,
returning null
if no WebApplicationContext found.
elContext
- the current JSF ELContextFacesContextUtils.getWebApplicationContext(javax.faces.context.FacesContext)