警告:此页面要求使用前缀fb声明的XML名称空间http://www.facebook.com/2008/fbml,但该名称空间不存在标签库 [英] Warning: This page calls for XML namespace http://www.facebook.com/2008/fbml declared with prefix fb but no taglibrary exists for that namespace
问题描述
我正在使用Javascript开发用于FB登录的应用程序.我在html中试过,效果很好.当我转换为JSF时会出现错误.
I am developing an application for FB Login with website using Javascript. I tried in html it works fine. when i convert into JSF it gives an error.
这是我的fbLogin.xhtml
代码.
<?xml version='1.0' encoding='UTF-8' ?>
<!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:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:fb="http://www.facebook.com/2008/fbml">
<h:head>
<title>FB Login</title>
<link rel="stylesheet" type="text/css" href="./xmlhttp/css/rime/rime.css"/>
</h:head>
<h:body styleClass="ice-skin-rime">
<fb:login-button scope="email"></fb:login-button>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '<APP_ID>',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// Additional initialization code here
showMe = function(response) {
if (response.status !== 'connected') {
div.innerHTML = '<em>Not Connected</em>';
} else {
FB.api('/me', function(response) {
var i=0;
for (var key in response) {
i++;
switch(i){
case 1: document.getElementById("formId:id").value=response[key]; break;
case 2: document.getElementById("formId:name").value=response[key]; break;
case 5: document.getElementById("formId:link").value=response[key]; break;
case 6: document.getElementById("formId:userName").value=response[key]; break;
case 19: document.getElementById("formId:email").value=response[key]; break;
}
}
});
}
};
FB.getLoginStatus(function(response) {
showMe(response);
FB.Event.subscribe('auth.authResponseChange', showMe);
});
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
</script>
<h:form id="formId">
<table>
<tr><td><a>ID : <h:inputText id="id" value="#{fbLogin.id}" /> </a></td></tr>
<tr><td><a>Name : <h:inputText id="name" value="#{fbLogin.name}" /> </a></td></tr>
<tr><td><a>Link : <h:inputText id="link" value="#{fbLogin.link}" /> </a></td></tr>
<tr><td><a>User Name : <h:inputText id="userName" value="#{fbLogin.userName}" /> </a></td></tr>
<tr><td><a>E-Mail : <h:inputText id="email" value="#{fbLogin.email}" /> </a></td></tr>
<tr><td><h:commandButton value="Register" action="#{fbLogin.Display}" /></td></tr>
</table>
</h:form>
</h:body>
</html>
用JSF编写代码的原因是,我需要将用户信息输入到backBean中以存储到数据库中.
The reason for writing code with JSF is, i need to get user information in to my backBean for store into database.
当我尝试运行该应用程序时,我在浏览器中收到警告:
when i try to run this app, i got warning in browser as :
Warning: This page calls for XML namespace http://www.facebook.com/2008/fbml declared with prefix fb but no taglibrary exists for that namespace.
我的代码有什么错误?
推荐答案
在webapp的web.xml
中将javax.faces.PROJECT_STAGE
设置为Development
并且Facelets遇到无法解析为与JSF兼容的标记库.仅仅显示此警告是为了通知(新手)开发人员XML命名空间中可能发生的不可预期的错字或标记库配置中的错误.
You will get this when you have set javax.faces.PROJECT_STAGE
to Development
in webapp's web.xml
and Facelets encounters a XML namespace which it could not resolve to a JSF compatible tag library. This warning is just displayed to inform a (starting) developer about a possible unforeseen typo in the XML namespace or mistake in tag library configuration.
但是,在这种特殊情况下,有问题的XML名称空间实际上引用了外部Facebook JavaScript API ,而不是诸如PrimeFaces,OmniFaces等JSF标签库.您的代码是完全可以的.
However, the XML namespace in question in this particular case actually referring an external Facebook JavaScript API, not a JSF tag library such as PrimeFaces, OmniFaces, etc. Your code is completely fine.
您可以忽略此警告.当您将JSF项目阶段重新设置为Production
或删除整个上下文参数(其默认值为Production
)时,不会出现此警告.
You can just ignore this warning. This warning won't appear when you set the JSF project stage back to Production
, or when you remove the whole context parameter (it defaults to Production
already).
这篇关于警告:此页面要求使用前缀fb声明的XML名称空间http://www.facebook.com/2008/fbml,但该名称空间不存在标签库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!