Our webapp contains some email-forms (contact, feedback, etc.).
For each of these email-types we have templates which will
be filled with some user specific data before the email is send.
I use tapestry to read, parse and fill-in data into the templates.
When the email-template is rendered i extract the rendered output
and send it as the body of an email.
My problem is, that the tapestry template parser is eating leading and
trailing
whitespace and newline that surround tapestry-components.
For example, the template
----------------------
<span jwcid="name"/>
<span jwcid="email"/>
---------------------
will be rendered to
---------------------
John [EMAIL PROTECTED]
---------------------
Is there a way to avoid this behaviour?
For the curious, here's the code i use to render the templates:
----------------------------------------
public String renderAndGetContent() throws RequestCycleException {
IEngine engine = getRequestCycle().getEngine();
RequestContext reqcontext = getRequestCycle().getRequestContext();
IMonitor monitor = getRequestCycle().getMonitor();
RequestCycle cycle = new RequestCycle(engine, reqcontext, monitor);
ByteArrayOutputStream out = new ByteArrayOutputStream();
IMarkupWriter writer = new HTMLWriter("text/plain", out);
cycle.setPage(this);
cycle.renderPage(writer);
writer.flush();
return out.toString();
}
This is called e.g. in a form-submit-listener
EmailFeedbackTemplatep = (EmailFeedbackTemplate)
cycle.getPage("EmailFeedbackTemplate");
.... // set some properties
String body = p.renderAndGetContent();
// send email
-----------------------------------------
Thanks for your help,
Oliver
-------------------------------------------------------
This SF.NET email is sponsored by: A Thawte Code Signing Certificate
is essential in establishing user confidence by providing assurance of
authenticity and code integrity. Download our Free Code Signing guide:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0028en
_______________________________________________
Tapestry-developer mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/tapestry-developer