Is it possible to design an email using JSP to be sent through Spring 3.0’s JavaMailSender mechanism? JavaMailSender probably has little to do with this question, but the idea is to take advantage of JSP’s <fmt:message key="phrasetitle"/> internationalization mechanism, its variable/loop JSTL code and allow designers to easily hand me completed html emails.
Additionally, I could make a webpage that imports this JSP so that I can easily provide a link in each email to be able to view that email on the web in case their client doesn’t see the html properly.
UPDATE: The 2 answers below suggest using Velocity for email instead of JSP, so it seems like that’s the smart choice. However, just some quick scanning of stackoverflow suggests FreeMarker might be better suited for my needs. In particular I want to be able to have a JSP page which mirrors what’s sent out in email. I’ll have to translate the code from JSP to Velocity or FreeMarker, but the advantage FreeMarker gives me is I can reuse a lot of the JSP code, particularly taglibs. Does this make sense?
JSP is not a templating technology. For that for example Velocity is a better choice.
If you really insist in using JSP, then you have got to execute it locally by
java.net.URL.