背景
我在Primefaces Web应用程序(版本2.2.1)中使用以下两个类(Search.java和SearchBean.java)。 com.actions
包中的所有类都是请求范围的bean,用于处理应用程序中的业务逻辑(actionListeners,Listeners等)。 com.beans
包中的类都是会话范围的bean,它们维护有关应用程序的状态。每个请求作用域都有一个使用CDI注入的会话作用域bean的实例,每个bean都由Spring管理。
问题:
当我升级到3.0.1时,Primefaces没有注册类,我收到类似com.actions.Search 的 Property'test'错误消息。这种情况发生在从Primefaces组件映射到下面的请求或会话bean的每个方法上。关于什么是适当的变化的任何想法?
例外:
javax.el.ELException: /WEB-INF/facelet/components/test.xhtml: Property 'process' not found on type com.actions.Search
com.sun.faces.facelets.compiler.AttributeInstruction.write(AttributeInstruction.java:94)
com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)
com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:183)
javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:853)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1652)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1655)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1655)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1655)
com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:399)
com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:115)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
com.dc.api.service.impl.CacheControlFilter.doFilter(CacheControlFilter.java:31)
com.dc.api.service.impl.HttpsCookieFilter.doFilter(HttpsCookieFilter.java:46)
处理业务逻辑并拥有会话范围bean实例的类
package com.actions;
import javax.inject.Inject;
import javax.inject.Named;
import org.springframework.context.annotation.Scope;
import com.beans.SearchBean;
@Named
@Scope("request")
public class Search{
@Inject
private SearchBean searchBean;
public void process() {
//business logic here
searchBean.get...
}
}
以会话状态维护数据的Bean
package com.beans;
import javax.inject.Named;
import org.springframework.context.annotation.Scope;
@Named
@Scope("session")
public class SearchBean {
private String text="test";
//getters and setters
}
以下替代方法也不起作用(只使用一个bean):
package com.actions;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Component
@Scope("session")
public class Search {
public void sessionIdleListener() {
}
}
答案 0 :(得分:2)
通过提供xmlns的新Primefaces 3.0.1命名空间解决了这个问题:p =“http://primefaces.org/ui”,因为它已经从以前版本的xmlns改变了:p =“http:// primefaces.prime.com.tr/ui“