cosmos
cosmos

Reputation: 2424

JSF 2 and Spring 3 integration

In our JSF 2, spring 3 web application we have the following sets of entries in the web.xml to integrate spring and JSF

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/config/spring/applicationContext.xml</param-value>
</context-param>

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

And it works!

However, after going through quiet a few JSF & spring tutorials I see the need to define a RequestContextListener in addition to the ContextLoaderListener.

We have both request scope and session scope beans in our application.

Are both listeners mandatory? What is the consequence of not defining the RequestContextListener?

Upvotes: 1

Views: 6131

Answers (1)

Michael Pralow
Michael Pralow

Reputation: 6630

both are not mandatory, only the ContextLoaderListener

see http://static.springsource.org/spring/docs/3.0.x/reference/web-integration.html and http://forum.springsource.org/showthread.php?t=81382

the RequestContextListener seems to be mandatory for Facelets

see http://static.springsource.org/spring/docs/3.0.x/api/org/springframework/web/context/request/RequestContextListener.html

This listener is mainly for use with third-party servlets, e.g. the JSF FacesServlet.

Upvotes: 1

Related Questions