I'm trying to find a way to generate a mail message with JSP. The problem is how to catch the output of the JSP processing to a String variable in the calling servlet. One possible solution is to use servlet chaining / filtering, but there has to be a better way.

There are many reasons for combining JavaMail and JSP. A common task in processing forms is sending an e-mail confirmation. Other common tasks are sending a monthly newsletter to subscribers or informing all subscribers of a new posting in a discussion group. The obvious servlet solution to these tasks would be to generate the mail message with JSP.

Any suggestions?

Jonas