gpt4 book ai didi

components - Primefaces 3.0 到 3.1 迁移

转载 作者:行者123 更新时间:2023-12-02 18:08:14 26 4
gpt4 key购买 nike

我尝试从 3.0 迁移到 3.1 primefaces,但在第一页上出现错误。

我正在测试与 jar-3.0.RC2.jar primefaces 完美配合的代码,并尝试更改 primefaces-3.1.RC1.jar。

感谢您的帮助。

服务器:JBOSS 6 Final。

代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:oc="http://java.sun.com/jsf/composite/components">

<h:head>
<title>#{msgs.pt_login}
</title>
<link rel="stylesheet" type="text/css"
href="#{request.contextPath}/css/base.css"/>
</h:head>
<h:body styleClass="login">

<h:form>
<p:selectOneMenu value="#{selectLanguageController.localizacion}" style="position:absolute;right: 0px">
<f:selectItems value="#{selectLanguageController.localizacionesMap}" />
<p:ajax event="change" process="@this" update="centerContainer"
listener="#{selectLanguageController.cambiarLocalizacion}"/>
</p:selectOneMenu>
<oc:themeSwitcher/>
</h:form>
<h:panelGrid id="centerContainer" style="margin-top: 25%;margin-left: auto;margin-right: auto;">
<h:form id="frmMain">
<p:panel style="width:100%;">
<p:focus context="frmMain"/>
<p:messages id="messages"/>
<f:facet name="header">#{msgs.pt_login}</f:facet>
<h:panelGrid id="loginFrm" columns="2" cellpadding="5">
<h:outputText value="#{msgs.lbl_usuario}"/>
<p:inputText id="txt_user" value="${sessionController.alias}"/>
<h:outputText value="#{msgs.lbl_password}"/>
<p:keyboard id="txt_password" value="#{sessionController.contrasena}"
showMode="button" buttonImageOnly="true"
buttonImage="/images/keyboardpencil.png"
password="true"/>
</h:panelGrid>
<p:commandButton action="#{sessionController.login}" value="${msgs.btn_login}" style="margin-left: auto;margin-right: auto;" ajax="false"/>
</p:panel>
</h:form>
</h:panelGrid>
</h:body>
</html>

而jboss抛出的错误如下:

17:06:20,450 INFO  [STDOUT] 
17:06:20,450 INFO [STDOUT] > > >> >> >>> >>>
17:06:20,450 INFO [STDOUT] **** Procesando una nueva Peticion ****
17:06:20,450 INFO [STDOUT] Antes de la fase--> RESTORE_VIEW 1
17:06:20,468 INFO [STDOUT] Despues de la fase--> RESTORE_VIEW 1--Vista /login.xhtml
17:06:20,469 INFO [STDOUT] Antes de la fase--> RENDER_RESPONSE 6
17:06:20,606 GRAVE [javax.enterprise.resource.webcontainer.jsf.application] Error Rendering View[/login.xhtml]: javax.faces.FacesException: Cannot find component with identifier "centerContainer" in view.
at org.primefaces.util.ComponentUtils.findClientIds(ComponentUtils.java:249) [:]
at org.primefaces.component.behavior.ajax.AjaxBehaviorRenderer.getScript(AjaxBehaviorRenderer.java:72) [:]
at javax.faces.component.behavior.ClientBehaviorBase.getScript(ClientBehaviorBase.java:99) [:2.0.3-]
at org.primefaces.renderkit.CoreRenderer.encodeClientBehaviors(CoreRenderer.java:332) [:]
at org.primefaces.component.selectonemenu.SelectOneMenuRenderer.encodeScript(SelectOneMenuRenderer.java:258) [:]
at org.primefaces.component.selectonemenu.SelectOneMenuRenderer.encodeEnd(SelectOneMenuRenderer.java:63) [:]
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:879) [:2.0.3-]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1650) [:2.0.3-]
at javax.faces.render.Renderer.encodeChildren(Renderer.java:164) [:2.0.3-]
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:849) [:2.0.3-]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1643) [:2.0.3-]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1646) [:2.0.3-]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1646) [:2.0.3-]
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:389) [:2.0.3-]
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:127) [:2.0.3-]
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:117) [:2.0.3-]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97) [:2.0.3-]
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135) [:2.0.3-]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:309) [:2.0.3-]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:734) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:541) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:479) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:407) [:6.0.0.Final]
at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:706) [:6.0.0.Final]
at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:677) [:6.0.0.Final]
at org.apache.jsp.index_jsp._jspService(index_jsp.java:63)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [:6.0.0.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [:1.0.0.Final]
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) [:6.0.0.Final]
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [:6.0.0.Final]
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [:6.0.0.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [:1.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [:6.0.0.Final]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [:6.0.0.Final]
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181) [:6.0.0.Final]
at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285) [:1.1.0.Final]
at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261) [:1.1.0.Final]
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88) [:6.0.0.Final]
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100) [:6.0.0.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [:6.0.0.Final]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [:6.0.0.Final]
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [:6.0.0.Final]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [:6.0.0.Final]
at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53) [:6.0.0.Final]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [:6.0.0.Final]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [:6.0.0.Final]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654) [:6.0.0.Final]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [:6.0.0.Final]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]

17:06:20,617 INFO [STDOUT] Despues de la fase--> RENDER_RESPONSE 6--Vista /login.xhtml
17:06:20,617 INFO [STDOUT] ******Peticion Procesada!!****
17:06:20,618 INFO [STDOUT] <<< <<< << << <
17:06:20,618 INFO [STDOUT]
17:06:20,618 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/OpenCEO].[Faces Servlet]] El Servlet.service() para servlet Faces Servlet lanzó una excepción: javax.faces.FacesException: Cannot find component with identifier "centerContainer" in view.
at org.primefaces.util.ComponentUtils.findClientIds(ComponentUtils.java:249) [:]
at org.primefaces.component.behavior.ajax.AjaxBehaviorRenderer.getScript(AjaxBehaviorRenderer.java:72) [:]
at javax.faces.component.behavior.ClientBehaviorBase.getScript(ClientBehaviorBase.java:99) [:2.0.3-]
at org.primefaces.renderkit.CoreRenderer.encodeClientBehaviors(CoreRenderer.java:332) [:]
at org.primefaces.component.selectonemenu.SelectOneMenuRenderer.encodeScript(SelectOneMenuRenderer.java:258) [:]
at org.primefaces.component.selectonemenu.SelectOneMenuRenderer.encodeEnd(SelectOneMenuRenderer.java:63) [:]
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:879) [:2.0.3-]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1650) [:2.0.3-]
at javax.faces.render.Renderer.encodeChildren(Renderer.java:164) [:2.0.3-]
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:849) [:2.0.3-]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1643) [:2.0.3-]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1646) [:2.0.3-]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1646) [:2.0.3-]
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:389) [:2.0.3-]
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:127) [:2.0.3-]
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:117) [:2.0.3-]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97) [:2.0.3-]
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135) [:2.0.3-]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:309) [:2.0.3-]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:734) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:541) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:479) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:407) [:6.0.0.Final]
at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:706) [:6.0.0.Final]
at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:677) [:6.0.0.Final]
at org.apache.jsp.index_jsp._jspService(index_jsp.java:63)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [:6.0.0.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [:1.0.0.Final]
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) [:6.0.0.Final]
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [:6.0.0.Final]
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [:6.0.0.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [:1.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [:6.0.0.Final]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [:6.0.0.Final]
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181) [:6.0.0.Final]
at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285) [:1.1.0.Final]
at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261) [:1.1.0.Final]
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88) [:6.0.0.Final]
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100) [:6.0.0.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [:6.0.0.Final]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [:6.0.0.Final]
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [:6.0.0.Final]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [:6.0.0.Final]
at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53) [:6.0.0.Final]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [:6.0.0.Final]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [:6.0.0.Final]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654) [:6.0.0.Final]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [:6.0.0.Final]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]

17:06:20,622 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/OpenCEO].[jsp]] Servlet.service() para servlet jsp lanzó excepción: javax.faces.FacesException: Cannot find component with identifier "centerContainer" in view.
at org.primefaces.util.ComponentUtils.findClientIds(ComponentUtils.java:249) [:]
at org.primefaces.component.behavior.ajax.AjaxBehaviorRenderer.getScript(AjaxBehaviorRenderer.java:72) [:]
at javax.faces.component.behavior.ClientBehaviorBase.getScript(ClientBehaviorBase.java:99) [:2.0.3-]
at org.primefaces.renderkit.CoreRenderer.encodeClientBehaviors(CoreRenderer.java:332) [:]
at org.primefaces.component.selectonemenu.SelectOneMenuRenderer.encodeScript(SelectOneMenuRenderer.java:258) [:]
at org.primefaces.component.selectonemenu.SelectOneMenuRenderer.encodeEnd(SelectOneMenuRenderer.java:63) [:]
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:879) [:2.0.3-]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1650) [:2.0.3-]
at javax.faces.render.Renderer.encodeChildren(Renderer.java:164) [:2.0.3-]
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:849) [:2.0.3-]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1643) [:2.0.3-]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1646) [:2.0.3-]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1646) [:2.0.3-]
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:389) [:2.0.3-]
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:127) [:2.0.3-]
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:117) [:2.0.3-]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97) [:2.0.3-]
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135) [:2.0.3-]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:309) [:2.0.3-]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:734) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:541) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:479) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:407) [:6.0.0.Final]
at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:706) [:6.0.0.Final]
at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:677) [:6.0.0.Final]
at org.apache.jsp.index_jsp._jspService(index_jsp.java:63)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [:6.0.0.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [:1.0.0.Final]
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) [:6.0.0.Final]
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [:6.0.0.Final]
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [:6.0.0.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [:1.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [:6.0.0.Final]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [:6.0.0.Final]
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181) [:6.0.0.Final]
at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285) [:1.1.0.Final]
at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261) [:1.1.0.Final]
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88) [:6.0.0.Final]
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100) [:6.0.0.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [:6.0.0.Final]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [:6.0.0.Final]
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [:6.0.0.Final]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [:6.0.0.Final]
at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53) [:6.0.0.Final]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [:6.0.0.Final]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [:6.0.0.Final]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654) [:6.0.0.Final]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [:6.0.0.Final]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]

最佳答案

您遇到的问题与从 3.0 到 3.1 所做的重大更改有关。在 3.0 早期,任何缺失的组件和 id 都会显示为警告,但现在它们会显示为异常。 为了摆脱这种情况,您必须为每个表单提供一个“id”。例如 替换“h:form”

h:form id="form1"

当使用update="centerContainer"时,使用update=":form1:centerContainer"

希望这会有所帮助。

关于components - Primefaces 3.0 到 3.1 迁移,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9120932/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com