我正在开发一个复合组件来集中和重用primefaces组件:
<?xml version="1.0"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:bridge="http://portletfaces.org/bridge"
xmlns:m3="http://java.sun.com/jsf/composite/m3jsf"
xmlns:Portlet="http://java.sun.com/portlet_2_0"
xmlns:composite="http://java.sun.com/jsf/composite">
<composite:interface>
<composite:attribute name="rendered" type="java.lang.Boolean" default="true"/>
</composite:interface>
<composite:implementation>
<span id="#{cc.clientId}">
<p:overlayPanel id="idPanelloListaDatiFullScreen" dynamic="true" appendToBody="false"
styleClass="m3PanelListaDati" binding="#{m3DataTableBackingBean.bindingVarOverlay}"
rendered="#{cc.attrs.rendered}">
</p:overlayPanel>
<p:panel id="idPanelloListaDati" styleClass="m3PanelListaDati"
rendered="#{cc.attrs.rendered}">
<composite:insertChildren></composite:insertChildren>
</p:panel>
</span>
</composite:implementation>
我在视图中使用它:
<m3:myCompositePanel id="idCompositePanel/>
但是当视图渲染时,会抛出异常:
Caused by: java.lang.NullPointerException
at javax.faces.component.UIComponentBase.findComponent(UIComponentBase.java:567)
at org.primefaces.component.overlaypanel.OverlayPanelRenderer.encodeScript(OverlayPanelRenderer.java:67)
at org.primefaces.component.overlaypanel.OverlayPanelRenderer.encodeEnd(OverlayPanelRenderer.java:37)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:881)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:312)
at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:105)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:851)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
at com.sun.faces.renderkit.html_basic.CompositeRenderer.encodeChildren(CompositeRenderer.java:78)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:851)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:851)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:439)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:124)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:286)
at com.liferay.faces.bridge.application.ViewHandlerCompatImpl.renderView(ViewHandlerCompatImpl.java:35)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:286)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
... 219 more
我正在使用PirmeFaces 3.5.23,mojarra 2.1.21和我在Liferay 6.1.3ga3和网桥3.1.3ga4中开发portlet
感谢您的帮助
答案 0 :(得分:1)
PrimeFaces OverlayPanelRenderer.java类的第67行正在尝试解析 for 属性的值。看起来您可能忘记在p:overlayPanel中为for属性指定值。