How to add custom namespace to HTML element in JSF?
I'm trying to add my custom namespace to <html>
element in JSF .xhtml
file (actually,开发者_如何学Python this namespace is not mine, it's Facebook's):
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
xmlns:fb="http://www.facebook.com/2008/fbml">
JSF/Mojarra gives me a warning:
Warning: This page calls for XML namespace http://www.facebook.com/2008/fbml
declared with prefix fb but no taglibrary exists for that namespace.
I can understand what it means, but how to solve the problem?
You can suppress the warning by adding the following lines in the web.xml file of your application:
..
<!-- Debug Output for Development -->
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Production</param-value>
</context-param>
...
There are two ways to go with this.
- delete the namespace if you aren't using it
- let JSF know about the namespace
To let JSF you either need the appropriate library on your classpath that is defining the taglibrary (maybe you are using a facebook.jar or something?). You will need to include this library in your .war file.
Or, if it is your own namespace, create a taglibrary file and make sure it is loaded in the web.xml, so that Facelets (I hope you are using Facelets with JSF, or JSF 2) will load the taglibrary and know the namespace.
精彩评论