public class SpringBeanWebFlowVariableResolver
extends javax.faces.el.VariableResolver
VariableResolver
that delegates to the
flow's local Spring bean factory (for resolving Spring beans) and then
to the original resolver of the underlying JSF implementation
(for resolving managed-bean objects as defined in faces-config.xml
as well as well-known implicit EL attributes).
Configure this resolver in your faces-config.xml
file as follows:
<application> ... <variable-resolver>org.springframework.faces.webflow.SpringBeanWebFlowVariableResolver</variable-resolver> </application>All your JSF expressions can then implicitly refer to the names of Spring-managed service layer beans, for example in property values of JSF-managed beans:
<managed-bean> <managed-bean-name>myJsfManagedBean</managed-bean-name> <managed-bean-class>example.MyJsfManagedBean</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> <managed-property> <property-name>mySpringManagedBusinessObject</property-name> <value>#{mySpringManagedBusinessObject}</value> </managed-property> </managed-bean>with "mySpringManagedBusinessObject" defined as Spring bean in applicationContext.xml:
<bean id="mySpringManagedBusinessObject" class="example.MySpringManagedBusinessObject"> ... </bean>
Modifier and Type | Field and Description |
---|---|
protected org.apache.commons.logging.Log |
logger
Logger available to subclasses
|
protected javax.faces.el.VariableResolver |
originalVariableResolver |
Constructor and Description |
---|
SpringBeanWebFlowVariableResolver(javax.faces.el.VariableResolver originalVariableResolver) |
Modifier and Type | Method and Description |
---|---|
protected org.springframework.beans.factory.BeanFactory |
getBeanFactory(javax.faces.context.FacesContext facesContext) |
protected javax.faces.el.VariableResolver |
getOriginalVariableResolver()
Return the original JSF VariableResolver that this resolver delegates to.
|
protected java.lang.Object |
resolveOriginal(javax.faces.context.FacesContext facesContext,
java.lang.String name)
Resolve the attribute via the original JSF VariableResolver.
|
protected java.lang.Object |
resolveSpringBean(javax.faces.context.FacesContext facesContext,
java.lang.String name)
Resolve the attribute as a Spring bean in the ApplicationContext.
|
java.lang.Object |
resolveVariable(javax.faces.context.FacesContext facesContext,
java.lang.String name)
Try to resolve the variable as Spring bean in the flow local bean factory.
|
protected final org.apache.commons.logging.Log logger
protected final javax.faces.el.VariableResolver originalVariableResolver
public SpringBeanWebFlowVariableResolver(javax.faces.el.VariableResolver originalVariableResolver)
protected final javax.faces.el.VariableResolver getOriginalVariableResolver()
public java.lang.Object resolveVariable(javax.faces.context.FacesContext facesContext, java.lang.String name) throws javax.faces.el.EvaluationException
resolveVariable
in class javax.faces.el.VariableResolver
javax.faces.el.EvaluationException
protected java.lang.Object resolveOriginal(javax.faces.context.FacesContext facesContext, java.lang.String name)
protected java.lang.Object resolveSpringBean(javax.faces.context.FacesContext facesContext, java.lang.String name)
protected org.springframework.beans.factory.BeanFactory getBeanFactory(javax.faces.context.FacesContext facesContext)