File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Sending JSP rendered html email from a Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Sending JSP rendered html email from a Servlet" Watch "Sending JSP rendered html email from a Servlet" New topic

Sending JSP rendered html email from a Servlet


Joined: Nov 04, 2004
Posts: 1
I am adding �email this page functionality� to an existing jsp/servlets based website. I can send html content without issue as long as it is written into the servlet sending the email. Is there a simple method for including the rendered html output from a jsp as the body of the html email? Or am I forced to reproduce the jsp pages as html for email? Any help would be appreciated as this seems like a problem that someone must have solved.

Thanks in advance.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33108

Welcome to JavaRanch!

We're pleased to have you here with us in the Servlets forum, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Forum Bartender
[ November 04, 2004: Message edited by: Jeanne Boyarsky ]

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
You can start an HTTP request to the JSP from your servlet and capture the output stream of the JSP into your email.
You will have to figure out a way to strip the HTTP headers yourself, but that's easy. Hint: what does every HTML document start with?

I agree. Here's the link:
subject: Sending JSP rendered html email from a Servlet
It's not a secret anymore!