So JSF in web tier and Spring in middle tier become an obvious choice. This document explains the steps involved in integrating these two frameworks.
Steps involved in integration
1. Add following lines in web.xml
This will load Spring Application context when web application starts.
2. Add applicationContext.xml file in WEB-INF folder
applicationContext.xml is a Spring configuration file. In the below snippet shows JSF managed bean entry.
3. Add following lines to faces-config.xml
When the code sample above is executed then the DelegatingVariableResolver would check to see if "SampleView" exists in spring and if it exists as a JSF managed bean as well. If it does DelegatingVariableResolver will then check to see if the bean already exists in the scope specified by
Above is one of the ways of integrating JSF and Spring. With this approach advantages of both the frameworks can be achieved. Using this approach one can also integrate Faces Portlets with Spring based business tier.
No comments:
Post a Comment