无法在复合组件中使用div标签

时间:2011-03-30 04:37:03

标签: java netbeans jsf-2 facelets

我编写了以下代码并将其另存为单独的文件。

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

使用ui:include将上述页面附加到主页面,并在主页末尾显示以下警告消息。

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. 

我们不能在这个ui:composition文件中使用html标签吗?

1 个答案:

答案 0 :(得分:4)

您是不是错过了在ui:composition

中包含xhtml名称空间
<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">