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.
I have in my XHTML file:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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#">
But the fb
and og
namespace won't be shown in the rendered source, only the XHTML namespace. How can I get these namespaces written to the response?
There is this issue: https://stackoverflow.com/questions/5199176/include-facebook-social-plugins-in-a-jsf2-page but it has not been answered yet.
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.
I hope someone has a better solution to that.
Additional information: I'm using facelets and seam 2.2.
I assume that ResponseWriter.startDocument()
prints the Doctype and <html>
element, is that correct? Or ist it just another UIComponent
that renders the <html>
element? It would be nice if I just could implement a custom ResponseWriter
and override startDocument()
and set my custom writer as default.
This leads me to 2 questions:
- Which class should I override so I don't have to implement every method of the abstract
ResponseWriter
? - How would I tell my application to use my custom
ResponseWriter
?
Or does implementing a custom component that renders the <html>
tag the job? I'm asking this because facelets seems to render the <html>
Tag by itself and there seems to be no way to change this, that's why I came up with overriding the ResponseWriter
.