title: Better Html Builder in java
body: <p>I want to get below output.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;table&gt;
  &lt;tbody&gt;
  &lt;thead&gt;
  Blah Blah table Header--Constant Part
  &lt;/thead&gt;
  &lt;tr&gt;
  some text-constant part
  &lt;/tr&gt;
  &lt;!---Main Customization Part--&gt;
  for(i=0;i&lt;some value;i++)
  {
  &lt;tr&gt;
      for(j=0;j&lt;another value;j++)
      {
          if(some condition)
          {
              &lt;td class=another varibale&gt;some text&lt;/td&gt;
          }
          else
          {
              &lt;td class=yet another varibale&gt;some text&lt;/td&gt;
          }
      }
  &lt;/tr&gt;
  }
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>As you can see its a mixture of html and it will generate the rest from java logic.
  Now here is my question-how can I implement in standalone java(i.e not jsp).I know I can write this to a normal file.But somehow I feel thats a ugly solution.Is there any way to get it done in some nicer way?
  Basically I am looking for a good HTML builder for java.
  Already checked-Freemarker.
  Also I am open to implement in any language,As java is my favourite language,so I am prefering it.</p>