2011-03-30 37 views
1

我編寫了下面的代碼並將其另存爲一個單獨的文件。複合組件內無法使用div標籤

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

請注意,它一直工作,這些只是XML解析器警告,沒有錯誤。當JSF項目階段未設置爲「Development」時,它們不會顯示。它們也不會與某些XML解析器結合使用(請閱讀:某些appservers)。 – BalusC 2011-03-30 11:32:38

回答

3

難道你不想錯過在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"> 
+0

xmlns =「http://www.w3.org/1999/xhtml」的確沒有。現在它可以工作。非常感謝:) – Selvin 2011-03-30 09:00:16

+0

很高興聽到它的作品! – 2011-03-30 09:41:31