This page calls for XML namespace declared with prefix br but no taglibrary exists
I just finished the Netbeans introduction to Hibernate tutorial ( http://netbeans.org/kb/docs/web/hibernate-webapp.html#01 ) and I am getting the following error: "This page calls for XML namespace declared with prefix br but no taglibrary exists"
Now, I have seen a similar question somewhere else: http://forums.sun.com/thread.jspa?threadID=5430327 but the answer is not listed there. Or, if it is, then I am clearly missing it -- line one of my index.xhtml file reads "http://www.w3.org/1999/xhtml". It also does not explain why, when I reload localhost:8080, the message disappears.
Here is my index.xhtml file:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core">
<ui:composition template="./template.xhtml">
<ui:define name="body">
<h:form>
<h:commandLink action="#{filmController.previous}" value="Previous #{filmController.pageSize}" rendered="#{filmController.hasPreviousPage}"/>
<h:commandLink action="#{filmController.next}" value="Next #{filmController.pageSize}" rendered="#{filmController.hasNextPage}"/>
<h:dataTable value="#{filmController.filmTitles}" var="item" border="0" cellpadding="2" cellspacing="0" rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all" style="border:solid 1px">
<h:column>
<f:facet name="header">
<h:outputText value="Title"/>
</f:facet>
<h:outputText value="#{item.title}"/>
</h:column>
<h:column>
<f:facet na开发者_如何学Pythonme="header">
<h:outputText value="Description"/>
</f:facet>
<h:outputText value="#{item.description}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value=" "/>
</f:facet>
<h:commandLink action="#{filmController.prepareView}" value="View"/>
</h:column>
</h:dataTable>
<br/>
</h:form>
</ui:define>
</ui:composition>
</html>
The problem clearly comes from the <br/>
tag, and facelets is trying to interpret it as a JSF/facelets tag with a prefix.
If we follow the standards, this tag should look like this <br />
(with a space before the slash). Try it that way, and if it doesn't work, try removing it.
I'm a few years late, but I have just done the same Hibernate tutorial, and faced exactly the same error. However, I do not think that the problem is related to the file index.xhtml. And while another poster is correct that the break tags should have a space, that change does not prevent the error "This page calls for XML namespace declared with prefix br but no taglibrary exists"
The problem lies in another xhtml file in the tutorial named browse.xhtml. You can see the content of that file using the tutorial link in the opening post. It contains an unmatched trailing </html> tag, and no reference to the http://www.w3.org/1999/xhtml namespace.
Pasting the content of that file into a HTML validator (e.g. validator.w3.org ) highlights the problems.
The solution that worked for me was to add the missing opening <html> tag:
<html xmlns="http://www.w3.org/1999/xhtml">
Alternatively, remove that unmatched trailing </html> tag, and add xmlns="http://www.w3.org/1999/xhtml" to the opening <ui:composition> tag.
精彩评论