haj*_*aju 2 configuration jsf spring
问题描述:我注入的Spring bean被定义为JSF支持bean的托管属性没有被实例化.当我检索Managed-Bean时,它总是会变为null.
我一整天都在与这个斗争,似乎JSF Managed Bean不会从Spring中读出applicationContext.我可以通过在一个支持bean中使用FacesContext来手动拔出bean,它会找到bean,但是当我尝试通过FacesConfig注入它时,它总是会出现null.我在下面列出了我如何整合它的步骤.有什么建议?
Icefaces 1.85
JSF 1.2(通过冰面servlet)
春天3.0
Websphere 7.5(我认为这是eclipse 3.5)
<listener>
<display-name>SpringListener</display-name>
<icon>
<small-icon>small.gif</small-icon>
<large-icon>large.gif</large-icon>
</icon>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
Run Code Online (Sandbox Code Playgroud)
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/SpringConfig/SpringHelloWorld.xml
</param-value>
</context-param>
Run Code Online (Sandbox Code Playgroud)
<application><variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver></application>
<managed-bean>
<managed-bean-name>testData</managed-bean-name>
<managed-bean-class>src.test.TestData</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>spring3HelloWorldBean</property-name>
<value>#{spring3HelloWorldBean}</value>
</managed-property>
</managed-bean>
Run Code Online (Sandbox Code Playgroud)
<bean id="spring3HelloWorldBean" class="src.test.Spring3HelloWorld" />
Run Code Online (Sandbox Code Playgroud)
提前致谢
dan*_*nik 12
首先,我认为你的问题是在1.1之后的所有JSF版本中不推荐使用DelegatingVariableResolver而你使用的是1.2所以请使用以下配置.
<application>
<el-resolver>
org.springframework.web.jsf.el.SpringBeanFacesELResolver
</el-resolver>
</application>
Run Code Online (Sandbox Code Playgroud)
希望能帮助到你.
归档时间: |
|
查看次数: |
9704 次 |
最近记录: |