commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ferindo Middleton <ferindo.middle...@gmail.com>
Subject [email] embed/include parsed JSP page file in email HTML body
Date Sun, 08 Aug 2010 21:28:08 GMT
I'm using Class HtmlEmail.  Is there a way to embed a parsed JSP page in the
email message body. I use Tomcat and Java Server Pages. In my JSP pages I
can do something like: <%@ include file="ticket_email_response_body.jsp" %>
and want to be able to included this processed .jsp file in the body of the
text message.

I've looked at the examples in the documentation for embedding Files and
images and I've tried the following example code but it doesn't embedded the
actual parsed .jsp into the image. It includes the file as an attachment and
puts the text string of the quoted text in the body of the message:

 File ticketEmailResponseBody = new
File("webapps/utrad/web/radtickets/ticket_email_response/ticket_email_response_dispatcher_page.jsp");
 StringBuffer msg = new StringBuffer();
 msg.append("<%@ include file=\"webapps/utrad/web/header.jsp\" %>");
 msg.append("<%@ include
file=").append(email.embed(ticketEmailResponseBody)).append(" %><BR><BR>");
 msg.append("+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+");

 URL emailBodyURL = new URL("
http://192.168.1.2:8080/utrad/web/radtickets/ticket_email_response/ticket_email_response_dispatcher_page.jsp
");
 String pid = email.embed(emailBodyURL,
"2nd_ticket_email_response_dispatcher_EMBEDDED_page.jsp");
 msg.append("<BR><BR>try the above code again a different way:<BR> <%@
include file=\"" + pid + "\" %><BR>- Ferindo<BR><BR>");

email.setHtmlMsg(msg.toString());
email.send();

none of the "appends" I use above end up including the .jsp page as parsed
data in the body of the email/not even the raw unparsed text is included in
the message body. Looking at the logs, it looks like it's included the raw
text content of the JSP file (unparsed) but it doesn't include the text in
the body of the email, just the following:
<%@ include file="webapps/utrad/web/header.jsp" %><%@ include
file=ekzvyazwil %>

...and it included two of the .jsps in the message above as attachments
instead, not exactly what I was trying to do.
-- 
Ferindo

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message