开发者

JSF 2 and Spring 3 integration

开发者 https://www.devze.com 2023-02-13 07:57 出处:网络
In our JSF 2, spring 3 web application we have the following sets of entries in the web.xml to integrate spring and JSF

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.conte开发者_高级运维xt.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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消