Render a JSP page into HTML in a String
843838Jul 5 2007 — edited Feb 20 2009I am using a mail template system that gets templates as JSP pages placed in /WEB-INF/mailtemplates/
I want to internally parse JSPs as if they were real JSPs in my tomcat but:
- Get get them using getResourceAsStream (or any other way)
- make JSP engine translate JSP into HTML into a String object.
- Send a mail with this HTML. (this part is already finished)
What I need is a method with the following proposed signature:
public String getMailTemplate(java.io.InputStream jspPageStream, javax.servlet.HttpServletRequest request) {}
The method must get the JSP from the stream, render it into the HTML and return it as a String.
Of course, it must render the JSP as a real JSP, using the apserver JSP engine. It must so replace any tags and EL objects:
${session.user.name} -> The name of the user
<c:forEach, ...
etc. etc. etc.
�Any ideas / directions on how to achieve this?
thanks,
Ignacio