6 Replies Latest reply on Mar 3, 2009 3:42 AM by Tony Herstell

    18.1.4. Multiple messages (email)

    Tony Herstell Master

      Re Manual: 18.1.4. Multiple messages:
      suggests putting ui:repeat


      humm.. dumb question probably,; but just wondering how you get ui: in before the m:message part...


      the ui: is not known as its only declared in the m:message tag.



      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:repeat value="#{recipients}" var="eachRecipient">
           <m:message xmlns="http://www.w3.org/1999/xhtml" xmlns:m="http://jboss.com/products/seam/mail"
                xmlns:h="http://java.sun.com/jsf/html" xmlns:s="http://jboss.com/products/seam/taglib">
                <m:from name="Selwyn Equestrian Centre" address="tony.herstell@selwynequestriancentre.co.nz" />
                <m:to name="#{user.firstname} #{user.surname}">#{user.email}</m:to>
                <m:cc>#{messages.email_tony_email}</m:cc>
                <m:cc>#{messages.email_brugs_email}</m:cc>
                <m:subject>Welcome to the Selwyn Equestrian Centre</m:subject>
                <m:body>
                     <p>
                          <h:outputText value="Dear #{eachRecipient.firstname}" />,
                     </p>
                     <p>
                          <h:outputText value="Dear #{theMessage.text}" />
                     </p>
                     <p>
                          <h:outputText value="#{messages.email_sec}" />
                     </p>
                     <p>
                          <h:outputText value="#{messages.email_website_sec}" />
                     </p>
                     <m:attachment rendered="#{eachRecipient.avatar ne null}"
                          value="#{eachRecipient.avatar.image}" fileName="#{eachRecipient.avatar.name}"
                          contentType="#{eachRecipient.avatar.type}" />
                </m:body>
           </m:message>
      </ui:repeat>


        • 1. Re: 18.1.4. Multiple messages (email)
          Pete Muir Master

          Put the namespace info into the ui:repeat tag.

          • 2. Re: 18.1.4. Multiple messages (email)
            Tony Herstell Master

            Yes, but how?


            yes I must be stupid...


            Googling is not helping!


            • 3. Re: 18.1.4. Multiple messages (email)
              Tony Herstell Master

              Its not:




              <?xml:namespace ns="http://java.sun.com/jsf/facelets" prefix="ui"?>





              • 4. Re: 18.1.4. Multiple messages (email)
                Pete Muir Master
                <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                <ui:repeat  
                   xmlns="http://www.w3.org/1999/xhtml"
                   xmlns:m="http://jboss.com/products/seam/mail"
                   xmlns:h="http://java.sun.com/jsf/html" 
                   xmlns:s="http://jboss.com/products/seam/taglib"
                   xmlns:ui="http://java.sun.com/jsf/facelets""
                   value="#{recipients}" 
                   var="eachRecipient">
                     <m:message>
                          <m:from name="Selwyn Equestrian Centre" address="tony.herstell@selwynequestriancentre.co.nz" />
                          <m:to name="#{user.firstname} #{user.surname}">#{user.email}</m:to>
                          <m:cc>#{messages.email_tony_email}</m:cc>
                          <m:cc>#{messages.email_brugs_email}</m:cc>
                          <m:subject>Welcome to the Selwyn Equestrian Centre</m:subject>
                          <m:body>
                               <p>
                                    <h:outputText value="Dear #{eachRecipient.firstname}" />,
                               </p>
                               <p>
                                    <h:outputText value="Dear #{theMessage.text}" />
                               </p>
                               <p>
                                    <h:outputText value="#{messages.email_sec}" />
                               </p>
                               <p>
                                    <h:outputText value="#{messages.email_website_sec}" />
                               </p>
                               <m:attachment rendered="#{eachRecipient.avatar ne null}"
                                    value="#{eachRecipient.avatar.image}" fileName="#{eachRecipient.avatar.name}"
                                    contentType="#{eachRecipient.avatar.type}" />
                          </m:body>
                     </m:message>
                </ui:repeat>

                • 5. Re: 18.1.4. Multiple messages (email)
                  Tony Herstell Master

                  DOH!


                  Sings the muppet song...


                  Thx

                  • 6. Re: 18.1.4. Multiple messages (email)
                    Tony Herstell Master

                    Having the repeat tag has proved incredibly un-reliable for large number of emails.


                    I am re-working the code to be much slower but more error-friendly by putting the loop in the code and at least then when the render fails I can carry on.


                    As WELL I will have a field with the user object which says what the last email Tag was so that I can run over the users multiple times until I have everyone having the last email set to the required email tag.