Are Richfaces and Primefaces compatible with each other?

喜欢而已 提交于 2019-12-11 01:51:20

问题


I am using Primefaces-2.1 now, I try to integrate Richfaces-3.3.3 in my application in order to use <rich:jQuery>. My <p:commandButton>, <p:commandLink> stop working as soon as I integrate the Richfaces, I give me this exception: Any idea why?

Exception in the filter chain
javax.servlet.ServletException: Index: 0, Size: 0
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:325)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
at com.scholar.filter.MyFilter.doFilter(MyFilter.java:36)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:277)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:637)

Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at javax.faces.component.AttachedObjectListHolder.restoreState(AttachedObjectListHolder.java:161)
at javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:1427)
at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1202)
at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1217)
at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1217)
at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1217)
at javax.faces.component.UIViewRoot.processRestoreState(UIViewRoot.java:865)
at org.ajax4jsf.component.AjaxViewRoot.processRestoreState(AjaxViewRoot.java:761)
at org.ajax4jsf.application.AjaxStateManager.restoreView(AjaxStateManager.java:456)
at com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:131)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:430)
at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:143)
at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:288)
at org.ajax4jsf.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:107)
at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:199)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:110)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)

Here is my web.xml

<servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<filter>
    <display-name>RichFaces Filter</display-name>
    <filter-name>richfaces</filter-name>
    <filter-class>org.ajax4jsf.Filter</filter-class>
</filter>

<filter-mapping>
    <filter-name>richfaces</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>INCLUDE</dispatcher>
</filter-mapping>

And here is all the library I include:
Primefaces-2.1
Richfaces-3.3.3
Commons-Logging-1.1.1
Commons-Digester-2.0
Commons-Beanutils-1.8.3
JHighlight-1.0


回答1:


Although not officially documented (as far as I see), the general (and logical) consensus is that you often cannot mix JSF 1.x based Ajax and CSS/JS sugared libraries like that, because they might have a different (thus, conflicting) way of view state and resource handling. JSF 2.x should bring change, because it standardizes partial (Ajaxical) view state handling as well as resource (CSS/JS) handling in the new API's. RichFaces 3.x isn't fully JSF 2.0 compatible, while PrimeFaces 2.x is, hence this conflict.

RichFaces 4.x should be fully JSF 2.0 compatible. But even then, I don't have a strong feeling of success when it comes to mixing "heavy-weight" Ajax/CSS/JS libraries like that. There are still risks in conflicts in "raw" CSS and JS areas since that's not standardized by JSF spec.



来源:https://stackoverflow.com/questions/3771966/are-richfaces-and-primefaces-compatible-with-each-other

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!