Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf 如何包含多个xhtml页面,这些页面将同一模板扩展到一个摘要xhtml页面,_Jsf_Jsf 2_Facelets - Fatal编程技术网

Jsf 如何包含多个xhtml页面,这些页面将同一模板扩展到一个摘要xhtml页面,

Jsf 如何包含多个xhtml页面,这些页面将同一模板扩展到一个摘要xhtml页面,,jsf,jsf-2,facelets,Jsf,Jsf 2,Facelets,如何将多个xhtml页面包含到摘要页面中。 这里是包含相同模板的所有xhtml页面 commonTemplate.xhtml 社交网站 共同正文内容。 updatePersonalDetails.xhtml .........; ..........; UpdateAddress.xhtml .........; ..........; 选择Preferences.xhtml .........; ..........; summary.xhtml 无论我在所有xhtml页面

如何将多个xhtml页面包含到摘要页面中。 这里是包含相同模板的所有xhtml页面

commonTemplate.xhtml

社交网站
共同正文内容。
updatePersonalDetails.xhtml

.........;
..........;
UpdateAddress.xhtml

.........;
..........;
选择Preferences.xhtml

.........;
..........;
summary.xhtml

无论我在所有xhtml页面中拥有什么样的数据,都应该在摘要页面中显示完全相同的数据。但包含此选项会导致在页面上呈现多个
文档


我们如何解决这个问题?

将正文内容移动到另一个模板中,您也可以通过
将其包含在模板客户端中

例如,
updatePersonalDetails.xhtml

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                template="commonTemplate.xhtml">

    <ui:define name="commonBodyContent">
        <ui:include src="updatePersonalDetails-content.xhtml" />
    </ui:define>

</ui:composition>


<强>无关的对具体问题,考虑放置模板并包含在>WEB-INF文件夹中,以防止它们被直接访问。另请参见

如果
updateddress.xhtml
selectPreferences.xhtml
等有更多的
ui:define
:s,除了
commonBodyContent
?比如说,一个
secTitle
字段。有没有一种方法可以在
updateddress content.xhtml
等中定义它,并在
updateddress.xhtml
summary.xhtml
中使用它?我想这与所问的是同一件事。
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                template="commonTemplate.xhtml">

    <ui:define name="commonBodyContent">
        .........;
        ..........;
    </ui:define>

</ui:composition>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                template="commonTemplate.xhtml">

    <ui:define name="commonBodyContent">
        .........;
        ..........;
    </ui:define>

</ui:composition>   
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                template="commonTemplate.xhtml">

    <ui:define name="commonBodyContent">
        .........;
        ..........;
    </ui:define>

</ui:composition>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets">

    <ui:include src="updatePersonalDetails.xhtml" />
    <ui:include src="updatedAddress.xhtml" />
    <ui:include src="selectPreferences.xhtml" />

</ui:composition>   
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                template="commonTemplate.xhtml">

    <ui:define name="commonBodyContent">
        <ui:include src="updatePersonalDetails-content.xhtml" />
    </ui:define>

</ui:composition>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                template="commonTemplate.xhtml">

    <ui:define name="commonBodyContent">
        <ui:include src="updatePersonalDetails-content.xhtml" />
        <ui:include src="updatedAddress-content.xhtml" />
        <ui:include src="selectPreferences-content.xhtml" />
    </ui:define>

</ui:composition>