tags:

views:

57

answers:

3

There have been some similar questions in stackoverflow but none of them answers my question. We want to send html , emails to users after they complete some action. We have written email templates in xsl and use DOM elements to create nodes, add dynamic data, parse xsl and substitute data. Although this works fine, it eats up too much memory. Is there any alternate solution ?

I do not want to write html code in java.

+1  A: 

One alternative is Velocity, it's known as a webpage-templating framework but you can use it to create templates for your emails too.

It occurred to me you might also try swapping out xsl processors and see if you can find a faster one, that would be less work than switching to Velocity.

Nathan Hughes
Any examples how can i use existing templates or xsl ?
vsingh
You wouldn't use xsl, it would be velocity templates. there is documentation with lots of examples on the apache velocity site. Note I'm not sure this would be faster than xsl, all I'm saying is it is an alternative. (xsl used to have a rep for being dog-slow, I don't know what it's like currently.)
Nathan Hughes
A: 

we use HTML.Template.java. You can also leverage a jsp.

Joseph
+2  A: 

If you are using Spring see example with Velocity.

amra
I am checking out velocity. That looks like the best bet to me.
vsingh
Works perfectly fine .
vsingh