commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ricardo Duval <rdg.du...@ibest.com.br>
Subject Re: [email] embed/include parsed JSP page file in email HTML body
Date Mon, 09 Aug 2010 17:18:12 GMT
As far as I understand he wants the HTML content generated by JSP parsing.

Sorry, but I don't think that'll work because you don't have a servlet
engine running when you try to attach the JSP, so obviously the servlet
won't be generate and all you gonna have is the original JSP script. I
recommend using a template engine, like velocity or freemarker to generate
an HTML content as a String.

2010/8/8 Siegfried Goeschl <siegfried.goeschl@it20one.at>

> Hi Ferindo,
>
> I'm not sure if I understand what you are doing ... :-)
>
> What is a "parsed JSP page"? Recently there was some work on adding HTML
> content and automatically adding embedding images.
>
> Cheers,
>
> Siegfried Goeschl
>
>
> On 08.08.10 23:28, Ferindo Middleton wrote:
>
>> 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.
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

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