Nathan,

I briefly looked into using jsp for email templating recently, and decided that it was not the right fit for the task in my situation.

Instead I ended up building a basic template merge facility using Velocity, and a mail sender facility based on JavaMail. I tied them together with a thin service layer in my webapp that is configurable and dead simple to invoke.

Using Velocity also allowed me to easily extend the system to include a web-based template manager and editor to allow users to create templates and verify them (preview) online.

Some of the advantages I found were:

- reasonably simple to build for basic merge/send
- easy to unit test in isolation (no dependencies on web container, jsp compiler)
- equally usable within a webapp or in a stand-alone app or script
- template authoring easily understood by non-programmers


The merger and sender are also independently unit tested with basic JUnit test cases.

It may be worth considering in your case as well.

- Ken


On Nov 25, 2004, at 6:59 PM, Jason Lea wrote:



Nathan Coast wrote:

Hi,

Is there any way to generate content that isn't written to the ServletResponse? I'd like to use jsp / struts to generate html emails.

something like this:
1) user clicks 'generate email' button.
2) struts action sets up parameters and identifies recipients.
3) delegate to a jsp to create the html email content.
4) trap the content (don't return to the user) and send as an email.
5) return a message to user confirming email has been sent.

is this possible without having to re-invent a servlet container :)

I have used Jelly (http://jakarta.apache.org/commons/jelly/) for this purpose. You can use JSTL/EL so it looks like a JSP page. Look at using Jelly Embedded (http://jakarta.apache.org/commons/jelly/tutorial.html#embeddingjelly)

thanks
Nathan



-- Jason Lea



---------------------------------------------------------------------
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