Assume a scenario that you need to send a dynamic email from a web application, something like a confirmation email for the user registration. It is easy to create that email, if it is a small email having only few lines. We can create it as a String value, and then send it via JavaMail or any other api. But what if it is a large email having hundreds of html tags with a large content? What is the best way to create it?
I think it is best if we can create that email as a JSP. So we can capture the output stream of that JSP using filters, and assign it to a String variable. But do you think that it is a good practice for here?
Well, JSP is a templating technology -- which is probably why your initial reaction was to try and use it. But I agree with Paul, using a templating engine would be more striaght-forward than trying to subvert JSP for that usage.