title: JavaServer Faces 2.2 composite component rendered with enclosing <html> ... </html> tags
body: <p>While migrating a project from JavaServer Faces 2.1 / Java EE 5 to JavaServer Faces 2.2 / Java EE 7 web profile on GlassFish 4, I encountered invalid HTML code because of additional <code>&lt;html&gt; ... &lt;/html&gt;</code> tags for every instance of a composite component in the JSF code.</p>
  
  <p>Environment: Mojarra 2.2.0 (GlassFish 4.0), NetBeans 7.3.1, JDK 7</p>
  
  <p>Steps to reproduce: </p>
  
  <ul>
  <li>create a new "Java EE 7 Web" project with JavaServer Faces and choose JSF 2.2 server library</li>
  <li>in index.html, select the HTML body text ("Hello from Facelets") and refactor into a composite component</li>
  </ul>
  
  <p>Example source code:</p>
  
  <p>index.html</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8' ?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://xmlns.jcp.org/jsf/html"
        xmlns:ez="http://xmlns.jcp.org/jsf/composite/ezcomp"&gt;
      &lt;h:head&gt;
          &lt;title&gt;Facelet Title&lt;/title&gt;
      &lt;/h:head&gt;
      &lt;h:body&gt;
          &lt;ez:test/&gt;
      &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>test.xhtml</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8' ?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:cc="http://xmlns.jcp.org/jsf/composite"&gt;
  
      &lt;!-- INTERFACE --&gt;
      &lt;cc:interface&gt;
      &lt;/cc:interface&gt;
  
      &lt;!-- IMPLEMENTATION --&gt;
      &lt;cc:implementation&gt;
          Hello from Facelets
      &lt;/cc:implementation&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Actual HTML output:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8' ?&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;head id="j_idt2"&gt;
          &lt;title&gt;Facelet Title&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  
      &lt;!-- INTERFACE --&gt;
  
      &lt;!-- IMPLEMENTATION --&gt;
          Hello from Facelets
  
  &lt;/html&gt;&lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This is not valid HTML as there is another <code>&lt;html&gt; ... &lt;/html&gt;</code> present for the composite component. Is there an error in my JSF code?</p>