Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Render a JSP page into HTML in a String

843838Jul 5 2007 — edited Feb 20 2009
I 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 20 2009
Added on Jul 5 2007
14 comments
3,404 views