如何在JSF 2.0中使用嵌套对象

时间:2012-02-24 23:16:39

标签: object jsf-2 nested nested-properties

<h:outputLabel value="#{bundle.CreateCustomerLabel_email}" for="email" /> 
<h:inputText id="email" value="#{customerController.selected.email}" title="#{bundle.CreateCustomerTitle_email}" /> 

<h:outputLabel value="Address:" for="addressId.address" /> 
<h:inputText size="30" id="address" value="#{customerController.selected.addressId.address}" title="Address" >
</h:inputText>

在Cutomer Entity bean中我得到了:

@JoinColumn(name = "address_id", referencedColumnName = "address_id")
@ManyToOne(optional = true, cascade={CascadeType.ALL})
private Address addressId;

在Address Entity bean中我得到了:

Basic(optional = true)
@NotNull
@Size(min = 1, max = 50)
@Column(name = "address")
private String address;

问题:如何在JSF 2.0表单中使用嵌套属性?我应该实现嵌套表单还是如何实现?

提前致谢! 萨米

1 个答案:

答案 0 :(得分:0)

你有获取addressId和地址的方法吗?第二个标签中的for属性必须为for="address"