在下面的代码中,在设置render属性后,Price的值没有在backing bean中设置。在此之前,它正在进入支持Bean。
h:dataTable id="Table" value="#{bean.orderList}" var="attr" binding="#{bean.orderTable}">
<h:column>
<f:facet name="header">
<h:outputText value="Item"/>
</f:facet>
<h:outputText value="#{attr.orderItem.itemId}" rendered="#{attr.orderItem.itemId != null}" />
<h:selectOneMenu value="#{attr.orderItem.itemId}" rendered="#{attr.orderItem.itemId == null}">
<f:selectItems value="#{bean.itemList}" var="attrList" itemValue="#{attrList.itemId}" itemLabel="#{attrList.itemName}" />
</h:selectOneMenu>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Price" />
</f:facet>
<h:outputText value="#{attr.price}" rendered="#{attr.orderItem.itemId != null}" />
<h:inputText value="#{attr.price}" rendered="#{attr.orderItem.itemId == null}" />
</h:column>
请在下面找到bean的代码
public String addAction() {
Order ord = new Order();
ord.setItems(new Items());
orderList.add(ord);
count=count+1;
return null;
}
@PostConstruct
public void populateForm(){
Order ord = new Order();
ord.setItems(new Items());
orderList= dataDao.getOrders();
ord.add(srcTrustScore);
}