我把类列表器放在我的WEb.xml中
<listener>
<listener-class>org.springframework.web.context.request.
RequestContextListener</listener-class>
</listener>
<application>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
</application>
<context:component-scan base-package="com.test.jsf" />
以及jsf中的managedbean
package com.test.jsf;
@ManagedBean
@Controller
@Scope(value = "request")
public class page1_backing
{
@Autowired
private UserInfo ui;
...
}
但显示添加处理程序的警告。然后我把
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler
但它不会让我去smmothe.please帮助我完成这项任务。
答案 0 :(得分:1)
不仅仅是RequestContextListener。还要添加ContextLoaderListener。
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
仅对托管bean使用@Component注释,
package com.test.jsf;
@Component
@Scope(value = "request")
public class page1_backing
{
@Autowired
private UserInfo ui;
...
}
它应该有用。