java.lang.NullPointerException:at com.sun.faces.renderkit.html_basic.HtmlResponseWriter.getAttributeValue

时间:2014-04-05 10:07:20

标签: jsf jsf-2.2 mojarra passthrough-attributes

我尝试在我的网络应用程序中使用新的直通属性功能,但是我遇到了可以为空的属性问题。这是代码:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 

"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui" 
      xmlns:util="http://xmlns.jcp.org/jsf/composite/util"
      xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
      xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
...
<p:outputPanel  pt:example="#{mybean.nullableAttribute}"  >
...
</p:outputPanel>

我得到了例外:

ERROR  javax.enterprise.resource.webcontainer.jsf.application 12:01:09.205 [http-listener-1(3)]  - Error Rendering View[/index.xhtml]
java.lang.NullPointerException: null
    at com.sun.faces.renderkit.html_basic.HtmlResponseWriter.getAttributeValue(HtmlResponseWriter.java:1215) ~[javax.faces-2.2.6.jar:2.2.6]
    at com.sun.faces.renderkit.html_basic.HtmlResponseWriter.flushAttributes(HtmlResponseWriter.java:1175) ~[javax.faces-2.2.6.jar:2.2.6]
    at com.sun.faces.renderkit.html_basic.HtmlResponseWriter.closeStartIfNecessary(HtmlResponseWriter.java:1117) ~[javax.faces-2.2.6.jar:2.2.6]
    at com.sun.faces.renderkit.html_basic.HtmlResponseWriter.startElement(HtmlResponseWriter.java:646) ~[javax.faces-2.2.6.jar:2.2.6]
    at org.primefaces.component.growl.GrowlRenderer.encodeEnd(GrowlRenderer.java:38) ~[primefaces-4.0.jar:4.0]
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919) ~[javax.faces-2.2.6.jar:2.2.6]
    at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:74) ~[primefaces-4.0.jar:4.0]
    at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:57) ~[primefaces-4.0.jar:4.0]
    at org.primefaces.component.outputpanel.OutputPanelRenderer.encodeMarkup(OutputPanelRenderer.java:64) ~[primefaces-4.0.jar:4.0]
    at org.primefaces.component.outputpanel.OutputPanelRenderer.encodeEnd(OutputPanelRenderer.java:40) ~[primefaces-4.0.jar:4.0]
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919) ~[javax.faces-2.2.6.jar:2.2.6]
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1864) ~[javax.faces-2.2.6.jar:2.2.6]
    at javax.faces.render.Renderer.encodeChildren(Renderer.java:176) ~[javax.faces-2.2.6.jar:2.2.6]
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:889) ~[javax.faces-2.2.6.jar:2.2.6]
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1857) ~[javax.faces-2.2.6.jar:2.2.6]
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1860) ~[javax.faces-2.2.6.jar:2.2.6]
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1860) ~[javax.faces-2.2.6.jar:2.2.6]

当属性为null时。当它不为空时它确实有效。我尝试过mojarra 2.2.0和2.2.6(我在glassfish 4.0上)

有什么想法吗?

谢谢!

2 个答案:

答案 0 :(得分:3)

此错误报告为issue 3208已在Mojarra 2.2.7中修复。

所以,至少该版本的upgrading应该这样做。目前,它已经是2.2.8。

答案 1 :(得分:0)

我终于使用了自定义EL功能