在我们的JSF2,Spring3web应用程序中,我们在web.xml中有以下几组条目来集成spring和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>而且起作用了!
然而,在阅读了一些JSF&Spring教程之后,我发现除了定义RequestContextListener之外,还需要定义一个ContextLoaderListener.
我们的应用程序中有请求作用域和会话作用域bean。
两位听众都是强制性的吗?不定义RequestContextListener的后果是什么?
发布于 2011-02-28 11:49:50
两者都不是强制性的,只有ContextLoaderListener
见http://static.springsource.org/spring/docs/3.0.x/reference/web-integration.html和http://forum.springsource.org/showthread.php?t=81382
RequestContextListener似乎对Facelets是强制性的
请参阅http://static.springsource.org/spring/docs/3.0.x/api/org/springframework/web/context/request/RequestContextListener.html
这个侦听器主要用于第三方servlet,例如JSF FacesServlet。
https://stackoverflow.com/questions/5124622
复制相似问题