我有一个 JSF 2/CDI webapp,可以动态配置一些特定的管理页面。它使用 bean 来决定要包含哪个页面:
<ui:include src="#{myBean.myDynamicPath}"/>
为了让它工作,我已经将我正在使用它的页面添加到 javax.faces.FULL_STATE_SAVING_VIEW_IDS 上下文参数中,并且在我将 JSF 库从 2.1.7 更新到 2.1.9 之前一切正常(并且它与最新的有同样的问题)。
当我尝试在页面上执行某些操作时,我得到一个很长的异常:
Oct 18, 2012 6:14:10 PM com.sun.faces.util.Util checkIdUniqueness
SEVERE: JSF1007: Duplicate component ID tabs:imagesListForm:imagesListDG:j_idt55 found in view.
Oct 18, 2012 6:14:10 PM com.sun.faces.util.Util checkIdUniqueness
SEVERE: +id: j_id1
type: javax.faces.component.UIViewRoot@4478de9f
+id: javax_faces_location_HEAD
... (all the view tree here) ...
Oct 18, 2012 6:14:10 PM com.sun.faces.application.view.FaceletViewHandlingStrategy handleRenderException
SEVERE: Error Rendering View[/admin/objects/edit.xhtml]
java.lang.IllegalStateException: Component ID tabs:imagesListForm:imagesListDG:j_idt55 has already been found in the view.
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:842)
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:826)
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:826)
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:826)
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:826)
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:826)
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:826)
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:826)
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:826)
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:826)
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:826)
at com.sun.faces.application.view.FaceletFullStateManagementStrategy.saveView(FaceletFullStateManagementStrategy.java:686)
at com.sun.faces.application.StateManagerImpl.saveView(StateManagerImpl.java:89)
at javax.faces.application.StateManager.getViewState(StateManager.java:553)
at com.sun.faces.context.PartialViewContextImpl.renderState(PartialViewContextImpl.java:417)
at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:300)
at javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:183)
at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:981)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:409)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:124)
at com.ocpsoft.pretty.faces.application.PrettyViewHandler.renderView(PrettyViewHandler.java:163)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at uk.co.novaware.core.cdi.scope.ConversationFilter.doFilter(ConversationFilter.java:36)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:412)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)
at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:137)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at uk.co.novaware.core.cdi.scope.ConversationFilter.doFilter(ConversationFilter.java:36)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
ui:include 的工作方式是否发生了变化?有人有什么想法让它再次工作吗?我需要更新 JSF 库。