Primefaces commandButton update在页面加载之前抛出错误

时间:2014-01-29 17:42:27

标签: primefaces jsf-2.2

首先我正在使用:  PrimeFaces 3.5 和JSF 2.2(Mojarra)

我有这个页面:

 <ui:composition>
    <ui:define>
        <p:layout id="layout">
            <p:layoutUnit id="west">
                <h:form id-"form_filter">
                    .
                    .
                    .
                    <p:commandButton action="#{bean.action}" update=":layout:center:form_tabs"/>
                </h:form>
            </p:layoutUnit>
            <p:layoutUnit id="center">
                <h:form id="form_tabs">
                    <p:tabView>
                        <p:tab>
                        <p:tab>
                        <p:tab>
                    </p:tabView>
                </h:form>
            </p:layoutUnit>
        </p:layout>
    </ui:define>
 </ui:composition>

当应用尝试加载此页面时,会出现以下错误

    SEVERE: Error Rendering View[/pages/research/research.xhtml]
    java.lang.IllegalArgumentException: layout
    at javax.faces.component.UIComponentBase.findComponent(UIComponentBase.java:608)
    at org.primefaces.util.ComponentUtils.findClientIds(ComponentUtils.java:245)
    at org.primefaces.util.AjaxRequestBuilder.addIds(AjaxRequestBuilder.java:102)
    at org.primefaces.util.AjaxRequestBuilder.process(AjaxRequestBuilder.java:84)
    at org.primefaces.renderkit.CoreRenderer.buildAjaxRequest(CoreRenderer.java:200)
    at org.primefaces.component.commandbutton.CommandButtonRenderer.encodeMarkup(CommandButtonRenderer.java:75)
    at org.primefaces.component.commandbutton.CommandButtonRenderer.encodeEnd(CommandButtonRenderer.java:50)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:877)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:308)
    at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:181)
    at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:125)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:847)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:300)
    at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:101)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:847)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1819)
    at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:847)
    at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:59)
    at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:47)
    at org.primefaces.component.layout.LayoutUnitRenderer.encodeEnd(LayoutUnitRenderer.java:51)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:877)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1826)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1822)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1822)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1822)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:395)
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:127)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:117)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:101)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

但是当我从p:commandButton中删除update参数时,它会正常加载。

任何提示?

谢谢大家,对不好的英语感到抱歉。

2 个答案:

答案 0 :(得分:2)

java.lang.IllegalArgumentException: someClientId
    at javax.faces.component.UIComponentBase.findComponent(UIComponentBase.java:608)

当异常消息中someClientId标识的组件(在您的特定情况下为layout实施NamingContainer时,将抛出此异常接口

事实上,根据Layout component API documentation,它没有实现该接口。只需在客户端ID选择器中删除该部分:

<p:commandButton ... update=":center:form_tabs" />

答案 1 :(得分:0)

<p:commandButton action="#{bean.action}" update=":form_tabs"/>

更新该行。实际上update=":layout:center:form_tabs"没有找到错误发生原因的布局。您不需要为layout和layoutunit定义id。简单的表单ID将适用于更新。如果您要更新tabview中的特定标签,请查看tabview和标签的ID,并更新<p:commandButton action="#{bean.action}" update=":form_tabs:tabviewid:tabid"/>