Por que ao comentar a parte tabela antiga do código me retorna um NullPointerException? Caso eu delete o código comentado, o erro não acontece.
<h:form id="formTabelaDeAutores">
<p:dataList value="#{autorBean.autores}" var="autor" type="definition">
<f:facet name="header">
Autores
</f:facet>
<p:commandLink styleClass="ui-icon ui-icon-pencil" style="float:left;margin-right:10px" action="#{autorBean.carregaAutor(autor)}" update="@form :autor"></p:commandLink>
<p:commandLink styleClass="ui-icon ui-icon-trash" style="float:left;margin-right:10px" action="#{autorBean.removeAutor(autor)}" update="@form"></p:commandLink>
#{autor.nome} - #{autor.email}
</p:dataList>
<!-- <h:dataTable id="tabelaDeAutores" value="#{autorBean.autores}"
var="autor">
<h:column>
<f:facet name="header">Autor</f:facet>
<h:outputText value="#{autor.nome}" />
</h:column>
<h:column>
OPÇÂO USANDO UMA CLASSE JAVA PARA CARREGAR AUTOR NO TEXTBOX
<f:facet name="header">Alterar</f:facet>
<h:commandLink value="altera"
action="#{autorBean.carregaAutor(autor)}"></h:commandLink>
</h:column>
<h:column>
<f:facet name="header">Remover</f:facet>
<h:commandLink value="remove"
action="#{autorBean.removeAutor(autor)}"></h:commandLink>
</h:column>
</h:dataTable> -->
</h:form>
Type Exception Report
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
javax.servlet.ServletException
javax.faces.webapp.FacesServlet.service(FacesServlet.java:671)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Root Cause
java.lang.NullPointerException
br.com.caelum.livraria.bean.AutorBean.carregaAutor(AutorBean.java:43)
sun.reflect.GeneratedMethodAccessor202.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
javax.el.BeanELResolver.invoke(BeanELResolver.java:158)
javax.el.CompositeELResolver.invoke(CompositeELResolver.java:79)
org.apache.el.parser.AstValue.getValue(AstValue.java:159)
org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
com.sun.faces.facelets.el.ELText$ELTextVariable.toString(ELText.java:228)
com.sun.faces.facelets.el.ELText$ELTextComposite.toString(ELText.java:161)
com.sun.faces.facelets.compiler.CommentInstruction.write(CommentInstruction.java:77)
com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)
com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:183)
javax.faces.render.Renderer.encodeChildren(Renderer.java:176)
javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:890)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:458)
com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:134)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:659)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Note The full stack trace of the root cause is available in the server logs.