290 CHAPTER 6: Component-Based Web Development Using JSF 2
Integrating JSF with Spring Framework
To integrate JSF with the Spring dependency injection framework, you have to do the following:
Add the ContextLoaderListener and RequestContextListener listeners provided
by the Spring Framework in web.xml
Add an el-resolver entry in faces-config.xml to point to the Spring class
SpringBeansFacesELResolver
Listing 6-18 illustrates adding ContextLoaderListener and RequestContextListener in the
web.xml file.
Listing 6-18. web.xml
- <?xml version="1.0" encoding="UTF-8"?>
- <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/
ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://
java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" metadata-
complete="true" version="3.0">
JSFBooks
Faces Servlet
javax.faces.webapp.FacesServlet
1
Faces Servlet
/faces/*
Faces Servlet
*.jsf
Faces Servlet
*.faces
State saving method: 'client' or 'server' (=default). See JSF Specification
2.5.2
javax.faces.STATE_SAVING_METHOD
client
javax.servlet.jsp.jstl.fmt.localizationContext
resources.application
com.sun.faces.config.ConfigureListener