如何将Facebook插件与JSF2页面集成?
我想在我的页面上集成一个facebook“喜欢”按钮,结果如下:如何将Facebook插件与JSF2页面集成?,facebook,jsf,jsf-2,Facebook,Jsf,Jsf 2,我想在我的页面上集成一个facebook“喜欢”按钮,结果如下: <!DOCTYPE html> <html lang="pt-br" xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/
<!DOCTYPE html>
<html lang="pt-br"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:fb="http://ogp.me/ns/fb#">
<h:head>
</h:head>
<h:body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '<filled with my app id>', // App ID
channelURL : '//www.suaparte.org', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
oauth : true, // enable OAuth 2.0
xfbml : true // parse XFBML
});
// Additional initialization code here
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
</script>
<div id="header">
<ui:insert name="header">
Header area. Please insert the header!
</ui:insert>
</div>
<div id="content">
<ui:insert name="content">
Content area. Please insert the content!
</ui:insert>
</div>
<div id="footer">
<fb:like href="suaparte.org" send="true" width="450" show_faces="true"></fb:like>
</div>
</h:body>
</html>
忽略警告。它来自Facelets,这是一种基于XML的视图技术,希望所有XML名称空间都引用Facelets标记库。如果您试图引用一个在类路径中根本不存在的Facelets标记库,那么在开发过程中,这个警告应该会有所帮助。例如,当您试图使用RichFaces组件但忘记实际安装RichFaces时 在Facebook的情况下,XML名称空间实际上是由客户端的JavaScript解释的,并且工作正常,因此您可以安全地忽略警告。如果将
javax.faces.PROJECT\u STAGE
设置为Production
,则它无论如何都不会出现。这些警告仅在设置为Development
时出现
Warning: This page calls for XML namespace http://ogp.me/ns/fb# declared with prefix fb but no taglibrary exists for that namespace.