I created a component that wrapped HTML on a page and sent it as an email. Basically, after every successful form submit, people usually display a "Form Submitted" page and I simply put the component there. It even has enough sense to convert relative urls with absolute urls and can even attach assets/images/css et al to the outgoing message as an option.

----- Original Message ----- From: "Wes Bramhall" <[EMAIL PROTECTED]>
To: "Tapestry users" <[email protected]>
Sent: Thursday, July 21, 2005 10:23 AM
Subject: Getting a Tapestry page as HTML for e-mail


I've been investigating using Tapestry to create "pages" which will
actually be sent as HTML e-mails. After doing some research, I found
some things that helped get it working in a test case.

PageName page = (PageName) cycle.getPage("PageName");
ByteArrayOutputStream out = new ByteArrayOutputStream();
HTMLWriter writer = new HTMLWriter(out);
cycle.activate(next);
cycle.renderPage(writer);
writer.flush();
String HTMLBody = out.toString();

Unfortunately, this scheme doesn't work in some of the areas we are
currently sending e-mail (during a form submit inside a component, etc.)
I tried to get the current page before that block, CurPage curPage =
(CurPage) cycle.getPage("CurPage");, and then cycle.activate(curPage);
after that block, but that kept giving me "page locked after a
commit();" type errors.

Does anyone else have ideas or a working implementation of using
Tapestry to load a random page to get the HTML, without disrupting the
current request lifecycle?

Thanks in advance,

Wes Bramhall
Widen Enterprises
Madison WI

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to