How to add custom namespace to HTML element in JSF?

I am trying to add my own namespace to the <html> element in the JSF .xhtml file (actually this namespace is not mine, this is Facebook):

 <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 this means, but how to solve the problem?

+7
source share
2 answers

You can suppress the warning by adding the following lines to 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> ... 
+1
source

There are two ways to do this.

  • remove the namespace if you are not using it.
  • tell JSF about the namespace

For JSF you need the appropriate library in your path to the class that defines the taglibrary (maybe you are using facebook.jar or something like that). You will need to include this library in your .war file.

Or, if this is your own namespace, create a taglibrary file and make sure it is loaded in web.xml so that Facelets (I hope you use Facelets with JSF or JSF 2) will load the taglibrary and recognize the namespace.

0
source

All Articles