In the past I have used Velocity for templating my Emails that my app sent. However, at the time I was also using velocity for my everyday view instead of
JSP's. Because of this my velocity engine was already loaded and initialized for the webapp.
The problem now is since I am not using Velocity as the view, using Velocity in my webapp is pretty much the same as using it in a stand alone app. And the operation of initializing Velocity is pretty heavy and slows the response down back from the server after I submit a page that sends an Email.
Also, I am trying to use as little 3rd party API's as possible to keep the app as small and simple as possible. What I want to do is use JSP's for templating my email. Here is my initial thought on how to do this. I hope someone can show me a better way.
I thought that I could use a URLConnection and it's InputStream to read the URL of one of my templates (JSP's) and then read each line throwing it into a StringBuffer and returning a
String, so something like:
What I don't like is it seems very hacky to do it this way. Is there a better way?