I want to achieve the 2 things at the same time.
I have a regular jsp page in Struts2. xx/yy/zz/email.jsp
<
I had this problem with using a mailing servlet use this to get the result of the jsp as a string:
HttpServletResponseWrapper responseWrapper = new HttpServletResponseWrapper(response) {
private final StringWriter sw = new StringWriter();
@Override
public PrintWriter getWriter() throws IOException {
return new PrintWriter(sw);
}
@Override
public String toString() {
return sw.toString();
}
};
request.getRequestDispatcher("email.jsp").include(request,
responseWrapper);
String result = responseWrapper.toString();
Set the email to give html content:
Email.send('me@me.com', 'you@you.com', 'My Subject', result);