在JSF primefaces应用程序上重用一些.xhtml页面

在JSF primefaces应用程序上重用一些.xhtml页面,jsf,facelets,Jsf,Facelets,我使用JSF和PrimeFaces开发了一个简单的应用程序,我面临一个问题: 这些是具有Person属性的托管bean: ClientBean EmployeeBean 我有person.xhtml,它显示了一个人的数据。我将person.xhtml包含在client.xhtml和employee.xhtml上。我需要创建两个person.xhtml,因为我使用的是不同的bean。我想做的是这样的: <c:set var="person" value="clientBean.perso

我使用JSF和PrimeFaces开发了一个简单的应用程序,我面临一个问题:

这些是具有
Person
属性的托管bean:

  • ClientBean
  • EmployeeBean
我有
person.xhtml
,它显示了一个人的数据。我将
person.xhtml
包含在
client.xhtml
employee.xhtml
上。我需要创建两个
person.xhtml
,因为我使用的是不同的bean。我想做的是这样的:

<c:set var="person" value="clientBean.person" /> 
<ui:include src="person.xhtml"/>

<c:set var="person" value="employeeBean.person" /> 
<ui:include src="person.xhtml"/>

在我的
person.xhtml
中,我可以使用
{person.name}
{person.dateOfBirth}
。 我在JSF中搜索并使用的
是错误的

有人可以帮忙吗?

将其作为
传递


小心重复的组件ID错误。另请参见。

@Nambari yes。我使用模板来构建页面。我需要的是如何从不同的bean获取数据并在同一个.xhtml页面中使用。
<ui:include src="person.xhtml">
    <ui:param name="person" value="#{clientBean.person}" /> 
</ui:include>
<ui:include src="person.xhtml">
    <ui:param name="person" value="#{employeeBean.person}" /> 
</ui:include>
<my:personForm value="#{clientBean.person}" /> 
<my:personForm value="#{employeeBean.person}" />