title: Java displaying HTML
body: <p>I'm trying to display HTML that I received from a server.  However, the current code is only working for very <em>few</em> and <em>simple</em> HTML code (e.g. bad request pages).</p>
  
  <p>This is a sample of very simple HTML that I cannot manage to display with my current code.</p>
  
  <pre><code> &lt;HTML&gt;&lt;HEAD&gt;&lt;meta http-equiv="content-type" content="text/html;charset=utf-8"&gt;
   &lt;TITLE&gt;302 Moved&lt;/TITLE&gt;&lt;/HEAD&gt;&lt;BODY&gt;
   &lt;H1&gt;302 Moved&lt;/H1&gt;
   The document has moved
   &lt;A HREF="http://www.google.be/index.html?gfe_rd=cr&amp;amp;ei=uhoTU6CaDoSNOrHrgeAL"&gt;here&lt;/A&gt;.
   &lt;/BODY&gt;&lt;/HTML&gt;
  </code></pre>
  
  <p>Here is my code which runs inside a <code>JFrame</code>.</p>
  
  <pre><code>JEditorPane ed1 = new JEditorPane("text/html", content);
  add(ed1);
  setVisible(true);
  setSize(600,600);
  setDefaultCloseOperation(EXIT_ON_CLOSE);
  </code></pre>
  
  <p>Note that <code>content</code> is just a string with every line of HTML concatenated to one another.  Like so: <code>content = "&lt;HTML&gt;.............&lt;/HTML&gt;"</code></p>
  
  <p>There might be more elegant solutions to fetching server responses and displaying them. But, I am restricted to the <code>java.io</code> and <code>java.net</code> packages.</p>