title: Pass JSP output stream to a method
body: <p>I've created a class MyClass that intends to output a large amount of text to a JSP. Rather than having the MyClass object return a string to be displayed on the page, I figured it would be a better idea for the MyClass object to use the page's output stream. Is this a good/possible idea?</p>
  
  <p>In testing possible ways to do this...</p>
  
  <p>These output the text, but it displays before the body of the page:</p>
  
  <pre><code>response.getWriter().append("test1");
  response.getWriter().println("test2");
  response.getWriter().write("test3");
  </code></pre>
  
  <p>This errors and tells me the output stream was already <em>gotten</em>:</p>
  
  <pre><code>response.getOutputStream().println("test4");
  </code></pre>