【发布时间】:2015-07-07 17:44:33
【问题描述】:
我使用 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中搜索并使用<c:set/>是错误的。
有人可以帮忙吗?
【问题讨论】:
-
@Nambari 是的。我使用模板来构建页面。我需要的是如何从不同的bean中获取数据并在同一个.xhtml页面中使用。