Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP for Mail Templating

 
Florain M�ller
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I'd like to use JSP for mail-templating, so I need to compile it inside my code. Like this: String contentInHTML = SomeUsefulClass.compile(pathToJsp). Certainly I need full feature support (reading from objects, i18n, ...)

But how can I do this? (btw. I use Spring but I don't think it's important)

Flo
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13077
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is that JSP is oriented completely to getting a HttpRequest and generating a HttpResponse. Even if you had a new servlet compiled from your JSP you would still need to create the request and response - needless complexity.

There are many other templating schemes, dynamic "scripting" languages, etc that are probably better suited to generation of HTML formatted emails. Back off a bit from JSP and look around.

How complex are the computing operations you need to conduct?

Bill
 
Florain M�ller
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bill

Yes I got that far to conceive that it's a big mess with the request and response. Concerning your question: they are not very complex. In fact I only wanted to assign the template an user-object an the template should print out the values. Furthermore I wanted to reuse spring-resource-bundle for i18n support because the email has to be internationalized and I don't feel like creating a template for every language.

So is there an other solution than JSP for that matter?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic