-
1. Re: create mail from a JSP content
afedoren Apr 4, 2006 4:48 AM (in response to gmeroz)Actually it could be implemented with wrapper
/**
*
* Get generated page body as String.
* Using :
*
*
* JspResponseWrapper my = new JspResponseWrapper(response) ;
* request.getRequestDispatcher( request.getContextPath() + "/index.jsp" ).include(request, my);
* String body = my.getBody() ;
*
*
*/
public class JspResponseWrapper extends javax.servlet.http.HttpServletResponseWrapper {
StringWriter sw ;
public JspResponseWrapper(javax.servlet.http.HttpServletResponse response) {
super(response) ;
sw = new StringWriter() ;
}
public PrintWriter getWriter() throws IOException {
PrintWriter pw = new PrintWriter(sw) ;
return pw ;
}
public String getBody() {
return sw.toString() ;
}
} -
2. Re: create mail from a JSP content
afedoren Apr 4, 2006 4:49 AM (in response to gmeroz)Code example :
JspResponseWrapper my = new JspResponseWrapper(response) ;
request.getRequestDispatcher( request.getContextPath() + "/index.jsp" ).include(request, my);
String body = my.getBody() ;
// and send mail now