title: how to convert PrintWriter to String or write to a File?
body: <p>I am generating dynamic page using JSP, I want to save this dynamically generated complete page in file as archive.</p>
  
  <p>In JSP, everything is written to <code>PrintWriter out  = response.getWriter();</code></p>
  
  <p>At the end of page, before sending response to client I want to save this page, either in file or in buffer as string for later treatment.</p>
  
  <p>How can I save <code>Printwriter</code> content or convert to <code>String</code>?</p>