czetsuya
czetsuya

Reputation: 5043

Warning: This page calls for XML namespace declared with prefix [html tag] but no taglibrary exists for that namespace

I know this question has been asked several times, but I just can't seem to find what's wrong with my code so I'm asking for it again - sorry :-).

I'm currently working on JSF2.1 on a JavaEE6 framework deployed on Glassfish. For the page that throws this error I have a baseTemplate, which includes a header and footer. Then I have a page that inherits the baseTemplate, basically here they are: BaseTemplate:

<?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:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core">
<f:view>
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title></title>
        <link rel="shortcut icon" href="" />
        <h:outputStylesheet library="css" name="site.css" target="head"></h:outputStylesheet>
        <ui:insert name="head" />
    </h:head>
    <h:body>
        <div id="wrapper" class="rounded-box">content...

Header

<?xml version='1.0' encoding='UTF-8' ?>
<f:view xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core">

    <div class="header">

Footer just contain, plain html tags.

And the actual page, which is a login.

<?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">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui"
    template="/shared/page/_twoColumn.xhtml">

    <ui:define name="head"></ui:define>
    <ui:define name="leftContent">
        </ui:define>
    <ui:define name="content">...........

What could be the problem? Note that I already have the xmlns:h="http://java.sun.com/jsf/html" namespace.

Thanks,
czetsuya

Upvotes: 3

Views: 11508

Answers (1)

BalusC
BalusC

Reputation: 1108557

Footer just contain, plain html tags.

You need to declare the default XML namespace of http://www.w3.org/1999/xhtml in the root element there as well. You'd better use <ui:composition> as XML root element in all include and template files (also the header; the <f:view> doesn't belong there at all).

/WEB-INF/footer.xhtml

<ui:composition 
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
>
    <div>Plain HTML</div>
</ui:composition>

The [html tag] which you're seeing in the warning message is the first plain HTML tag which appears in the footer.

See also:

Upvotes: 10

Related Questions