Spring JSF integration
Join the DZone community and get the full member experience.
Join For Freeintegrating 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/
Topics:
Opinions expressed by DZone contributors are their own.
Comments