Can be done. This example should get you started.
public class MyEmailResponse extends HttpServletResponseWrapper {
Writer out;
public MyEmailResponse(HttpServletResponse res) {
super(res);
out = new StringWriter();
}
public Writer getWriter() {
return out;
}
// You may need to override some other methods here
};
Then in your servlet:
MyEmailResponse mer = new MyEmailResponse(response);
RequestDispatcher rd =
getServletContext().getRequestDispatcher("/myEmail.jsp");
rd.include(request, mer);
mer.flushBuffer();
StringWriter sw = (StringWriter)mer.getWriter();
String emailMessage = sw.toString();
"Andoni" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hello,
I have written a little method for my servlet that let's me know when
something goes wrong. It sends me an email the body of which is a simple
java.lang.String. This is easy as I cut mostly from a book I have ;-)
Anyway, my question now is, I want to have my RequestDipatcher fill out a
jsp page and send this as the body of the email. Can anyone tell me how to
achieve this?
How do I convert the .jsp with all it's parameters filled in, into a
java.lang.String?
My thanks in advance,
Andoni.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]