【问题标题】:Templates for Richfaces4 pagesRichfaces4 页面的模板
【发布时间】: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 谢谢。

【问题讨论】:

    标签: richfaces demo


    【解决方案1】:

    您可能会在“使用 Facelets 模板”部分的 Java EE 6 教程中找到答案: http://docs.oracle.com/javaee/6/tutorial/doc/giqxp.html

    当您点击“查看源代码”链接时看到的是客户端页面的代码,因此您还需要一个模板。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-07-27
      • 2010-11-23
      • 2011-09-19
      • 1970-01-01
      • 1970-01-01
      • 2012-10-08
      • 2014-09-27
      • 1970-01-01
      相关资源
      最近更新 更多