title: JSP Document/JSPX: what determines how tabs/space/linebreaks are removed in the output?
body: <p>I've got a "JSP Document" ("JSP in XML") nicely formatted and when the webpage is generated and sent to the user, some linebreaks are removed.</p>
  
  <p>Now the really weird part: apparently the "main" .jsp always gets <em>all</em> its linebreak removed but for any subsequent .jsp included from the main .jsp, linebreaks seems to be randomly removed (some are there, others aren't).</p>
  
  <p>For example, if I'm looking at the webpage served from Firefox and ask to <em>"view source"</em>, I get to see what is generated.</p>
  
  <p>So, what determines when/how linebreaks are kept/removed?</p>
  
  <p>This is just an example I made up... Can you force a .jsp to serve this:</p>
  
  <pre><code>&lt;body&gt;&lt;div id="page"&gt;&lt;div id="header"&gt;&lt;div class="title"&gt;...
  </code></pre>
  
  <p>or this:</p>
  
  <pre><code>&lt;body&gt;
    &lt;div id="page"&gt;
      &lt;div id="header"&gt;
        &lt;div class="title"&gt;...
  </code></pre>
  
  <p>?</p>
  
  <p>I take it that linebreaks are removed to save on bandwidth, but what if I want to keep them?  And what if I want to keep the same XML indentation as in my .jsp file?</p>
  
  <p>Is this doable?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Following skaffman's advice, I took a look at the generated .java files and the "main" one doesn't have lots of <em>out.write</em> but not a single one writing tabs nor newlines.  Contrary to that file, all the ones that I'm including from that main .jsp have lots of lines like:</p>
  
  <pre><code>out.write("\t...\n");
  </code></pre>
  
  <p>So I guess my question stays exactly the same: what determines how tabs/space/linebreaks are included/removed in the output?</p>