2012-06-22 46 views
0

我想在tomcat7中使用richfaces4的一些示例。 如果我將http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=panel&skin=emeraldTown的「查看源代碼」中的代碼複製到test.xhtml文件中。如果我去http://localhost/jsf-blank/test.jsf。我只會看到帶有PLAIN TEXT的網頁,而不是演示中顯示的面板...Richfaces4頁面的模板

我發現了2種使其像演示頁面一樣的方法。

第一種方式是:

<!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:h="http://java.sun.com/jsf/html" 
    xmlns:f="http://java.sun.com/jsf/core" 
    xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:a4j="http://richfaces.org/a4j" 
    xmlns:rich="http://richfaces.org/rich"> 
<h:head> 
</h:head> 
<h:body> 
    <--!!!insert rich:panel tags here!!!--> 
</h:body> 
</html> 

第二種方式是:

<ui:composition xmlns="http://www.w3.org/1999/xhtml" 
xmlns:h="http://java.sun.com/jsf/html" 
xmlns:f="http://java.sun.com/jsf/core" 
xmlns:ui="http://java.sun.com/jsf/facelets" 
xmlns:a4j="http://richfaces.org/a4j" 
xmlns:rich="http://richfaces.org/rich"> 

<f:view> 
<h:head></h:head> 
<h:body> 
    <--!!!insert rich:panel tags here!!!--> 
</h:body> 
</f:view> 

</ui:composition> 

問: 可能有人更深入地解釋爲什麼上面的2個工作代碼,但是代碼的直接從演示不起作用? 看起來像標籤是渲染組件的關鍵。有人問這個類似的問題RichFaces4 don't render the components 謝謝。

回答