【发布时间】:2012-06-22 00:59:51
【问题描述】:
我正在tomcat7 中尝试一些richfaces4 的示例。
如果我将http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=panel&skin=emeraldTown 的“查看源代码”中的代码复制到 test.xhtml 文件中。如果我去http://localhost/jsf-blank/test.jsf。我只会看到一个带有纯文本的网页,而不是演示中显示的面板...
我找到了 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>
问题: 有人可以更深入地解释为什么上述两段代码有效但直接来自演示的代码无效??? 看起来标签是渲染组件的关键。这里有人问过类似的问题RichFaces4 don't render the components 谢谢。
【问题讨论】: