Facebook social plugins and JSF

蹲街弑〆低调 提交于 2019-12-04 21:22:51

I found out that I just had to write a custom component:

public class CvHTML extends UIOutput {
    @Override
    public void encodeBegin(final FacesContext context) throws IOException {
        final ResponseWriter writer = context.getResponseWriter();
        writer.startDocument();
        writer.startElement("HTML", null);
        writer.writeAttribute("xmlns", "http://www.w3.org/1999/xhtml", null);
        writer.writeAttribute("xmlns:fb", "http://www.facebook.com/2008/fbml", null);
        writer.writeAttribute("xmlns:og", "http://ogp.me/ns#", null);
    }

    @Override
    public void encodeEnd(final FacesContext context) throws IOException {
        final ResponseWriter writer = context.getResponseWriter();
        writer.endElement("HTML");
        writer.endDocument();
    }
}

and call now in the main template:

<cv:html xmlns="http://www.w3.org/1999/xhtml" lang="en"
    xmlns:s="http://jboss.com/products/seam/taglib"
    ....
    xmlns:cv="http://your.name.space/foo">
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!