[jboss-cvs] jboss-seam/doc/reference/en/modules ...
Peter Muir
peter at bleepbleep.org.uk
Thu Jan 25 05:58:24 EST 2007
User: pmuir
Date: 07/01/25 05:58:24
Modified: doc/reference/en/modules mail.xml
Log:
Tidy up example, improve docs
Revision Changes Path
1.3 +51 -8 jboss-seam/doc/reference/en/modules/mail.xml
(In the diff below, changes in quantity of whitespace are not shown.)
Index: mail.xml
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/doc/reference/en/modules/mail.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- mail.xml 24 Jan 2007 22:43:11 -0000 1.2
+++ mail.xml 25 Jan 2007 10:58:24 -0000 1.3
@@ -11,11 +11,10 @@
currently supported. </para>
<section>
- <title>Introduction</title>
- <para>In Seam Mail, an email template is just facelet:</para>
+ <title>Creating a message</title>
+ <para>In Seam Mail, an email is just facelet:</para>
<programlisting>
<m:message xmlns="http://www.w3.org/1999/xhtml"
- xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:m="http://jboss.com/products/seam/mail"
xmlns:h="http://java.sun.com/jsf/html">
@@ -25,8 +24,9 @@
<m:body>
<p><h:outputText value="Dear #{person.firstname}" />,</p>
- <p>You can try out Seam by visiting <a href="http://labs.jboss.com/jbossseam">http://labs.jboss.com/jbossseam</a>.</p>
- <p>Regards</p>
+ <p>You can try out Seam by visiting
+ <a href="http://labs.jboss.com/jbossseam">http://labs.jboss.com/jbossseam</a>.</p>
+ <p>Regards,</p>
<p>Peter</p>
</m:body>
@@ -56,7 +56,50 @@
}
}</programlisting>
- <para>If, for example, you entered an invalid email address, then an exception would be thrown, which is caught and then displayed to the user.</para>
+ <para>If, for example, you entered an invalid email address, then an exception would be thrown, which is caught
+ and then displayed to the user.</para>
+
+ <section>
+ <title>HTML/Text alternative part</title>
+ <para>Whilst most mail readers nowadays support HTML, some don't, so you can add a plain text alternative
+ to your email body:</para>
+ <programlisting><m:body>
+ <f:facet name="alternative">Sorry, your email reader can't show our fancy email,
+please go to http://labs.jboss.com/jbossseam to explore Seam.</f:facet>
+</m:body></programlisting>
+ </section>
+
+ <section>
+ <title>Multiple recipients</title>
+ <para>Often you'll want to send an email to a group of recipients (for example your users). All of the recipient
+ mail tags can be placed inside a <literal><ui:repeat></literal>:</para>
+ <programlisting><ui:repeat value="#{allUsers} var="user">
+ <m:to name="#{user.firstname} #{user.lastname}" address="#{user.emailAddress}" />
+</ui:repeat></programlisting>
+ </section>
+
+ <section>
+ <title>Templating</title>
+ <para>The mail templating example shows that facelets templating 'just works' with the Seam mail tags.</para>
+ <para>Our <literal>template.xhtml</literal> contains:</para>
+ <programlisting><m:message>
+ <m:from name="Seam" address="do-not-reply at jboss.com" />
+ <m:to name="#{person.firstname} #{person.lastname}">#{person.address}</m:to>
+ <m:subject>#{subject}</m:subject>
+ <m:body>
+ <html>
+ <body>
+ <ui:insert name="body"> This is the default body, specified by the template.</ui:insert>
+ </body>
+ </html>
+ </m:body>
+</m:message></programlisting>
+ <para>Our <literal>templating.xhtml</literal> contains:</para>
+ <programlisting><ui:param name="subject" value="Templating with Seam Mail" />
+<ui:define name="body">
+ <p>This email demonstrates that you can easily use <i>facelets templating features</i> in your code!</p>
+</ui:define></programlisting>
+ </section>
</section>
More information about the jboss-cvs-commits
mailing list