Feeds:
Posts
Comments

Archive for July 11th, 2011

Spring JSF integration

integration spring with jsf is easy, you just needs 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 that you want to use the spring bean, you need to add spring bean to the managed bean class as 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 🙂

Advertisements

Read Full Post »