Using Email Template in Spring
I am developing a small utility application emailafriend using Spring. The basic functionality is to email the current url to a friend. As of now I am using a fixed email template which I have hard coded in the class something like -
StringBuffer buf = new StringBuffer(form.getSenderName());
buf.append(" want to look at this page: ").append("\n\n<");
buf.append("http://").append(host).append(form.getPageUrl()).append(">\n\n");
buf.append("Please click on the link above for more information.");
buf.append("\n\n");
But, the email templates can be changed frequently as per busine开发者_开发百科ss. Can I utilize spring for this purpose (or any other way), so that I don't have to the Java code again and again.
I suggest using a template engine such as Freemarker for this (or Velocity, but Freemarker is better, IMO). Spring provides support for these.
精彩评论