3 Replies Latest reply on Oct 13, 2008 3:05 PM by Matthias Goetz

    Accessing components by seam mail

    Matthias Goetz Newbie

      Hello,


      i've got a problem accessing a seam component in a mail template.


      My setup:
      JBoss 4.2.3.GA
      Seam 2.0.2.SP1


      Mails are sent via an asynchronous mail component with a template.
      Component values are set via:
      Contexts.getEventContext().set(training, training);


      Accessing the components in the mail works fine, except an array i
      want to display in the mail via h:dataTable. I'm able to display
      the size of the array, but the displayed table is array and
      i get a null pointer exception. I think the defined trainingParticipant
      variable is not initalized.


      The stacktrace:


      15:44:16,900 ERROR [STDERR] java.lang.NullPointerException
      15:44:16,903 ERROR [STDERR]     at com.sun.faces.el.ManagedBeanELResolver.getVal
      ue(ManagedBeanELResolver.java:80)
      15:44:16,906 ERROR [STDERR]     at javax.el.CompositeELResolver.getValue(Composi
      teELResolver.java:53)
      15:44:16,910 ERROR [STDERR]     at com.sun.faces.el.FacesCompositeELResolver.get
      Value(FacesCompositeELResolver.java:72)
      15:44:16,914 ERROR [STDERR]     at org.jboss.el.parser.AstIdentifier.getValue(As
      tIdentifier.java:44)
      15:44:16,917 ERROR [STDERR]     at org.jboss.el.parser.AstValue.getValue(AstValu
      e.java:63)
      15:44:16,920 ERROR [STDERR]     at org.jboss.el.ValueExpressionImpl.getValue(Val
      ueExpressionImpl.java:186)
      15:44:16,925 ERROR [STDERR]     at com.sun.facelets.el.TagValueExpression.getVal
      ue(TagValueExpression.java:71)
      15:44:16,935 ERROR [STDERR]     at javax.faces.component.UIOutput.getValue(UIOut
      put.java:184)
      15:44:16,939 ERROR [STDERR]     at com.sun.faces.renderkit.html_basic.HtmlBasicI
      nputRenderer.getValue(HtmlBasicInputRenderer.java:201)
      15:44:16,944 ERROR [STDERR]     at com.sun.faces.renderkit.html_basic.HtmlBasicR
      enderer.getCurrentValue(HtmlBasicRenderer.java:284)
      15:44:16,948 ERROR [STDERR]     at com.sun.faces.renderkit.html_basic.HtmlBasicR
      enderer.encodeEnd(HtmlBasicRenderer.java:154)
      15:44:16,951 ERROR [STDERR]     at javax.faces.component.UIComponentBase.encodeE
      nd(UIComponentBase.java:861)
      15:44:16,955 ERROR [STDERR]     at com.sun.faces.renderkit.html_basic.HtmlBasicR
      enderer.encodeRecursive(HtmlBasicRenderer.java:242)
      15:44:16,961 ERROR [STDERR]     at com.sun.faces.renderkit.html_basic.TableRende
      rer.renderRow(TableRenderer.java:312)
      15:44:16,964 ERROR [STDERR]     at com.sun.faces.renderkit.html_basic.TableRende
      rer.encodeChildren(TableRenderer.java:133)
      15:44:16,968 ERROR [STDERR]     at javax.faces.component.UIComponentBase.encodeC
      hildren(UIComponentBase.java:837)
      15:44:16,971 ERROR [STDERR]     at org.jboss.seam.ui.util.JSF.renderChild(JSF.ja
      va:175)
      15:44:16,973 ERROR [STDERR]     at org.jboss.seam.ui.util.JSF.renderChildren(JSF
      .java:163)
      15:44:16,979 ERROR [STDERR]     at org.jboss.seam.mail.ui.MailComponent.encode(M
      ailComponent.java:85)
      15:44:16,984 ERROR [STDERR]     at org.jboss.seam.mail.ui.MailComponent.encode(M
      ailComponent.java:59)
      15:44:16,987 ERROR [STDERR]     at org.jboss.seam.mail.ui.UIBody.encodeChildren(
      UIBody.java:44)
      15:44:16,998 ERROR [STDERR]     at org.jboss.seam.ui.util.JSF.renderChild(JSF.ja
      va:175)
      15:44:17,001 ERROR [STDERR]     at org.jboss.seam.ui.util.JSF.renderChildren(JSF
      .java:163)
      15:44:17,004 ERROR [STDERR]     at org.jboss.seam.mail.ui.UIMessage.encodeChildr
      en(UIMessage.java:165)
      15:44:17,008 ERROR [STDERR]     at org.jboss.seam.ui.util.JSF.renderChild(JSF.ja
      va:175)
      15:44:17,013 ERROR [STDERR]     at org.jboss.seam.ui.util.JSF.renderChildren(JSF
      .java:163)
      15:44:17,017 ERROR [STDERR]     at org.jboss.seam.ui.facelet.FaceletsRenderer.re
      nderFacelet(FaceletsRenderer.java:207)
      15:44:17,020 ERROR [STDERR]     at org.jboss.seam.ui.facelet.FaceletsRenderer$1.
      process(FaceletsRenderer.java:161)
      15:44:17,023 ERROR [STDERR]     at org.jboss.seam.ui.facelet.FaceletsRenderer$Re
      nderingContext.run(FaceletsRenderer.java:79)
      15:44:17,028 ERROR [STDERR]     at org.jboss.seam.ui.facelet.FaceletsRenderer.re
      nder(FaceletsRenderer.java:170)
      


      --- snip ----



      The code:



      <h:dataTable value="#{training.mailTrainingParticipants}" var="trainingParticipant">
      <h:column>
          <f:facet name="header">
              <h:outputText value="Name" />
          </f:facet>
          <h:outputText value="#{trainingParticipant.driver.surName}" />
      </h:column>
      
      <h:column>
          <f:facet name="header">
              <h:outputText value="Vorname" />
          </f:facet>
          <h:outputText value="#{trainingParticipant.driver.givenName}" />
      </h:column>
      </h:dataTable>




      Anyone knows that problem or can me explain a workaroung displaying
      array data in a mail component?


      Thanks in advance...


      Matthias