title: Facebook social plugins and JSF
body: <p>I have to integrate the Facebook social plugins into a JSF application. This recommends that I add the fbml namespace to the xhtml file that it's rendered in the response.</p>
  
  <p>I have in my XHTML file:</p>
  
  <pre><code>&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:ui="http://java.sun.com/jsf/facelets"
    ...
    xmlns:fb="http://www.facebook.com/2008/fbml"
    xmlns:og="http://ogp.me/ns#"&gt;
  </code></pre>
  
  <p>But the <code>fb</code> and <code>og</code> namespace won't be shown in the rendered source, only the XHTML namespace. How can I get these namespaces written to the response?</p>
  
  <p>There is this issue: <a href="https://stackoverflow.com/questions/5199176/include-facebook-social-plugins-in-a-jsf2-page">https://stackoverflow.com/questions/5199176/include-facebook-social-plugins-in-a-jsf2-page</a> but it has not been answered yet.</p>
  
  <p>The only idea I've got is to make an iframe and include a simple XHTML file (not a Facelet, just pure XHTML), but this seems to be dirty.</p>
  
  <p>I hope someone has a better solution to that.</p>
  
  <hr>
  
  <p>Additional information: I'm using facelets and seam 2.2.</p>
  
  <p>I assume that <code>ResponseWriter.startDocument()</code> prints the Doctype and <code>&lt;html&gt;</code> element, is that correct? Or ist it just another <code>UIComponent</code> that renders the <code>&lt;html&gt;</code> element? It would be nice if I just could implement a custom <code>ResponseWriter</code> and override <code>startDocument()</code> and set my custom writer as default.</p>
  
  <p>This leads me to 2 questions:</p>
  
  <ol>
  <li>Which class should I override so I don't have to implement every method of the abstract <code>ResponseWriter</code>?</li>
  <li>How would I tell my application to use my custom <code>ResponseWriter</code>?</li>
  </ol>
  
  <p>Or does implementing a custom component that renders the <code>&lt;html&gt;</code> tag the job? I'm asking this because facelets seems to render the <code>&lt;html&gt;</code> Tag by itself and there seems to be no way to change this, that's why I came up with overriding the <code>ResponseWriter</code>.</p>