Search code examples
javanetbeansjsf-2facelets

unable to use div tag inside composite components


I wrote the following code and save it as a separate file.

<!DOCTYPE html>
<ui:composition
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets">
    <div id="crb_header">
     <br/>
     <h4 align="right">Welcome : #{homebean.user}</h4>
     <br/>
    </div>
</ui:composition>

The above page is attached to the main page usingui:include and the following warning messages are visible at the end of the main page.

Warning: This page calls for XML namespace declared with prefix div but no taglibrary exists for that namespace.
Warning: This page calls for XML namespace declared with prefix h4 but no taglibrary exists for that namespace.
Warning: This page calls for XML namespace declared with prefix br but no taglibrary exists for that namespace.
Warning: This page calls for XML namespace declared with prefix br but no taglibrary exists for that namespace. 

Can't we use html tags inside this ui:composition files?


Solution

  • Didn't you miss to include the xhtml namespace inside the ui:composition?

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