You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Victor Hugo Garcia <vi...@aplicaciones.com.co> on 2011/03/02 16:15:39 UTC
composite component with a method expression throws NPE when used
inside a datatable
Hi,
I created the following composite component, named imageLink:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:composite="http://java.sun.com/jsf/composite">
<composite:interface>
<composite:attribute name="url" type="String" required="true"/>
<composite:attribute name="actionMethod" method-signature="String
action()" />
<composite:attribute name="styleClass" default="image" type="String"/>
<composite:attribute name="label" type="String"/>
</composite:interface>
<composite:implementation>
<h:commandLink action="#{cc.attrs.actionMethod}">
<h:graphicImage url="#{cc.attrs.url}"
styleClass="#{cc.attrs.styleClass}"/>
<h:outputText value="#{cc.attrs.label}"/>
</h:commandLink>
</composite:implementation>
</html>
then i used in a page like this:
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:a="http://java.sun.com/jsf/composite/components/aplica"
template="/templates/masterLayout.xhtml">
<ui:define name="links">
<h:form>
<a:imageLink url="/images/pdf.png" label="#{bundle.verPDF}"
actionMethod="#{programaFidelidadBean.verPDF}"/>
<a:imageLink url="/images/new.png" label="#{bundle.Ingresar}"
actionMethod="#{programaFidelidadBean.ingresarProgramaFidelidad}"/>
</h:form>
</ui:define>
<ui:define name="title">
<h:outputText value="#{bundle.ProgramaFidelidad_lista}"
styleClass="title"/>
</ui:define>
<ui:define name="content">
<h:form id="programasFidelidadForm">
<h:dataTable id="programas"
value="#{programaFidelidadListaBean.programasFidelidad}"
var="programaFidelidad">
<h:column>
<a:imageLink url="/images/edit.png" alt="#{bundle.Editar}"
actionMethod="#{programaFidelidadListaBean.editar}"/>
<a:imageLink url="/images/clone.png" alt="#{bundle.Clonar}"
actionMethod="#{programaFidelidadListaBean.clonar}"/>
<a:imageLink url="/images/pdf.png" alt="#{bundle.Informe}"
actionMethod="#{programaFidelidadListaBean.verPDF}"/>
</h:column>
<h:column>
...
the links defined in the section "links" works fine, but when i click the
links inside the datable, i get this error:
Caused by: java.lang.NullPointerException
at
org.apache.myfaces.view.facelets.el.ValueExpressionMethodExpression.getExpressionString(ValueExpressionMethodExpression.java:70)
at
org.apache.myfaces.view.facelets.el.TagMethodExpression.getExpressionString(TagMethodExpression.java:101)
at
javax.faces.component._MethodExpressionToMethodBinding.getExpressionString(_MethodExpressionToMethodBinding.java:60)
at
org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:97)
at javax.faces.component.UICommand.broadcast(UICommand.java:120)
at javax.faces.component.UIData.broadcast(UIData.java:761)
at javax.faces.component.UIViewRoot._broadcastAll(UIViewRoot.java:969)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:275)
at javax.faces.component.UIViewRoot._process(UIViewRoot.java:1281)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:707)
at
org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:34)
at
org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:171)
... 33 more
Thanks for your help,
Victor Garcia.
--
View this message in context: http://old.nabble.com/composite-component-with-a-method-expression-throws-NPE-when-used-inside-a-datatable-tp31050301p31050301.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.