【发布时间】:2011-10-18 06:36:52
【问题描述】:
我想在我的视图中使用<f:loadBundle> 标签。我知道我可以在faces-config.xml 中声明它,但出于某种原因,我想在我的视图中使用它。我以这种方式使用标签,但它不起作用。我在<ui:composition> 标签内使用它。
<h:head>
<title>Email Content</title>
</h:head>
<h:body>
<ui:composition template="./WEB-INF/templates/layout.xhtml">
<ui:define name="content">
<f:loadBundle basename="presentationBeans.homepage.messages" var="msgs"/>
<h:form id="emailContent_Review" >
<p:growl id="growl" showDetail="true" />
<p:panel id="panel"
header="#{msgs.ECR_panelHeader}"
style="border-color: #000000;width: 960px;position: absolute;left: 150px;height: 370px" >
<p:dataTable value="#{emailContent_Review.emailContent}"
var="emailContent"
selection="#{emailContent_Review.selectedEmailContent}"
emptyMessage="#{msgs.ECR_tableEmptyMessage}"
widgetVar="portalsTable"
rows="8" height="350" paginator="true">
<f:facet name="header" >
</f:facet>
</p:dataTable>
</p:panel>
</h:form>
</ui:define>
</ui:composition>
</h:body>
我做错了什么?我也读到了
要使用模板,您可以使用带有“模板”属性的“ui:composition”标签。 Facelets 删除了标签之外的所有标签——即 doctype 声明、html、head、title 和 body 标签。这是必要的,因为
<ui:composition>被替换为包含其自己的一组 html、head、title 和 body 标记的模板。
如果我想在 head 部分使用我的属性文件,那么我该如何使用它?因为 head 部分在 <ui:composition> 标签之外。我的意思是说,如果我想这样做
<h:head>
<title>#{msgs.indexWindowTitle}</title>
</h:head>
那么我如何在<ui:composition>之外使用我的属性文件?
【问题讨论】:
标签: jsf-2