views:

414

answers:

1

I was investigating FreeMarker (and also Velocity), and one of the things I liked about FreeMarker was that I could use it with my existing JSP tags. However, it's become my understanding that this will only work when using FreeMarker as a view for servlets. Is there a way to use these JSP tag libraries with either FreeMarker or Velocity in a non-servlet context, i.e. for generating email messages?

+1  A: 

There is a way, but it's not exactly pretty :)

FreemarkerServlet (or Spring's view resolver, if you're using Spring MVC) exposes JspTaglibs hash that you need in order to use tags in templates and emulates JSP environment used by tags (scopes in particular). You'll have to do it yourself in your email processor.

See details here: Using JSP custom tags in FTL

ChssPly76