Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Spring JSF integration

DZone's Guide to

Spring JSF integration

· Java Zone
Free Resource

Learn how to troubleshoot and diagnose some of the most common performance issues in Java today. Brought to you in partnership with AppDynamics.

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/

Understand the needs and benefits around implementing the right monitoring solution for a growing containerized market. Brought to you in partnership with AppDynamics.

Topics:

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}