Platinum Partner
java,jsf,spring

Spring JSF integration

Integrating Spring with JSF is easy, you just need to follow these steps:

1)In web.xml make sure that you have (context listener + context param) :

<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>

<context-param>
<param-name>
contextConfigLocation
</param-name>
<param-value>
/WEB-INF/applicationContext*.xml
</param-value>
</context-param>

2) You need to use “DelegatingVariableResolver” in faces-config.xml:

<faces-config>
<application>
<variable-resolver>
org.springframework.web.jsf.DelegatingVariableResolver
</variable-resolver>
…..
</faces-config>

3) In the managed bean where you want to use the Spring bean, you need to add the Spring bean to the managed bean class as a property:

<managed-bean>
<managed-bean-name>…</managed-bean-name>
<managed-bean-class>…</managed-bean-class>
<managed-bean-scope>…</managed-bean-scope>
<managed-property>
<property-name>manager</property-name>
<value>#{manager}</value>
</managed-property>
</managed-bean>

 

Thats it :)

 

From http://java4you.wordpress.com/2011/07/11/spring-jsf-integration/

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}