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

标签 jsf richfaces seam

我正在用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/

相关文章:

javascript - 如何选择不属于当前可见月份的每个可见日期?

java - 下拉菜单 "Conversion Error setting value ' ' 为 'null Converter' "

java - 我应该选择哪个框架——Seam、Wicket、JSF 或 GWT?

java - 如何设置当用户输入文件夹 URL 时打开文件夹的默认页面?

css - 为什么丰富 :modalPanel styleclass styles not being applied to it?

java - JSF - 在没有表单的情况下更新数据库中的行

Java richfaces TreeNode 子节点计数

java - 在 Seam 的 Java 类中使用消息包

css - <富 :fileUpload> CSS customization: Don't need '+' symbol in button

MultilingualString 对象的 JSF 复合组件