【发布时间】:2015-07-13 21:11:46
【问题描述】:
我从使用 JSP 的 JSF 1.2 迁移到使用 Facelets 的 JSF 2.1。
我使用 oracle ADF Faces 作为组件库。
我的主页布局不再适用于 Facelets。
这是我的布局:
<af:form id="mainForm">
<af:decorativeBox theme="medium" styleClass="AFVisualRoot">
<f:facet name="center">
<!-- Main page -->
<af:panelStretchLayout topHeight="35" bottomHeight="20" >
<!-- Top menu -->
<f:facet name="top">
<af:panelStretchLayout endWidth="255" startWidth="100%">
<f:facet name="end">
</f:facet>
<f:facet name="start">
</f:facet>
</af:panelStretchLayout>
</f:facet>
<!-- Page footer -->
<f:facet name="bottom">
<af:region id="footerRegion" showHeader="never"
value="#{main.footerModel}" />
</f:facet>
<!-- Page body -->
<f:facet name="center">
<af:panelSplitter orientation="horizontal"
splitterPosition="450">
<f:facet name="first">
<af:region id="browserRegion" showHeader="never"
value="#{main.browserModel}" />
</f:facet>
<f:facet name="second">
<af:region id="contentRegion" showHeader="never"
value="#{main.contentModel}" />
</f:facet>
</af:panelSplitter>
</f:facet>
</af:panelStretchLayout>
</f:facet>
</af:decorativeBox>
</af:form>
正如 documentation 中关于 decoratingBox 的中心面所说的“这个 facet 不支持 facelets 中的多个 facet 组件”
如果我仍然想使用 Facelets,如何进行页面布局并仍然受益于 decoratingBox?
更新:
我的问题来自使用 <ui:include> inside facets :
<!-- Top menu -->
<f:facet name="top">
<af:panelStretchLayout endWidth="255" startWidth="100%">
<f:facet name="end">
</f:facet>
<f:facet name="start">
<ui:include src="/components/menu.xhtml" />
</f:facet>
</af:panelStretchLayout>
</f:facet>
这里是 menu.xhtml 的一部分:
<?xml version='1.0' encoding='UTF-8'?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:trh="http://myfaces.apache.org/trinidad/html"
xmlns:tr="http://myfaces.apache.org/trinidad"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
xmlns:afh="http://myfaces.apache.org/trinidad/html">
<af:menuBar id="headerMenuBar">
<!-- Menu Item -->
</af:menuBar>
</ui:composition>
在 ADF 组件中包含使用 Facelet 的页面的正确方法是什么?
【问题讨论】:
-
您能否详细说明“我的主页不再可用”?你到底得到了什么?空白页、异常、500 错误?
-
提示:不要使用 ADF,只是不要。
-
QueryLars,您是否有足够的 ADF 实践经验来做出这样的假设?我自己,我无法为其他 JSF 实现做出这样的声明,即使我在这里和那里使用了其中的一些。当然,ADF 有一些缺点,但它也带来了许多其他框架无法提供的功能。最大的问题是没有人在至少 2 个 JSF 实现方面拥有丰富经验来真正比较它们。
-
@FlorinMarcus,您能确认我按原样发布的代码应该正常显示吗?我不再确定可能是什么问题,因为我在 decoratingBox 中有另一个页面,其中包含应有的显示。我必须进一步调查以查看问题所在。稍后我可能会完成我的问题。
-
您应该使用区域和任务流,而不是“包含”标签。
标签: jsf jsf-2 facelets oracle-adf