gpt4 book ai didi

jsf - 如何在其他定义内设置定义

转载 作者:行者123 更新时间:2023-12-04 14:25:50 24 4
gpt4 key购买 nike

我正在用jboss,seam,richfaces开发一个Web应用程序。

我正在使用template(xhtml)作为所有其他模板的母版,并且在其中设置了两个插入标签。 <ui:insert name="head"/>
<ui:insert name="body"/>

问题在于,在使用该母版页作为模板的页面中,必须在<ui:define name="head">...</ui:define>内定义<ui:define name="body">...</ui:define>


我怎样才能做到这一点?


基本上,我要执行以下操作:


<ui:define name="body">... <ui:define name="head"> <meta name="title" content="#{something.title}" /> </ui:define> ...</ui:define>


母版页必须返回:<meta name="title" content="#{something.title}" />上的<ui:insert name="head"/>

提前致谢

最佳答案

我不认为facelets会那样工作。它编译并读取模板。

因此,我认为您可以定义所需的定义,而不必关心嵌套。

即:

//In your template.xhtml
<ui:insert name="outer">
BLA BLA BLA
<ui:insert name="inner"/>
BLA BLA BLA
</ui:insert>


当您只想使用此模板时:

 <ui:define name="outer">
Here you can overwrite outer (This will probably overwrite inner, not sure, you need to test it)
</ui:define>

<ui:define name="inner">
Or you can ONLY overwrite inner here if you want
</ui:define>

关于jsf - 如何在其他定义内设置定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2071787/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com