Jsf 如何包含多个xhtml页面,这些页面将同一模板扩展到一个摘要xhtml页面,
如何将多个xhtml页面包含到摘要页面中。 这里是包含相同模板的所有xhtml页面 commonTemplate.xhtmlJsf 如何包含多个xhtml页面,这些页面将同一模板扩展到一个摘要xhtml页面,,jsf,jsf-2,facelets,Jsf,Jsf 2,Facelets,如何将多个xhtml页面包含到摘要页面中。 这里是包含相同模板的所有xhtml页面 commonTemplate.xhtml 社交网站 共同正文内容。 updatePersonalDetails.xhtml .........; ..........; UpdateAddress.xhtml .........; ..........; 选择Preferences.xhtml .........; ..........; summary.xhtml 无论我在所有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>
<强>无关的对具体问题,考虑放置模板并包含在
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>