我有一个selectOneMenu
和一个dataTable
。当我更改所选值时,dataTable
将重新填充。的一列dataTable
是一个inputText
。问题是该inputText
字段不调用getter
,而是缓存以前的值。
我想getter
强制调用或设置inputText
为不被缓存。我该如何摆脱这个问题?
<h:body>
<f:view>
<h:form id="headForm">
<ice:selectOneMenu id="item"
value="#{outerBean.selectedItem}"
valueChangeListener="#{outerBean.itemListValueChanged}"
style="width: 158px;" required="true"
label="Supplier Id" partialSubmit="true">
<f:selectItems value="#{outerBean.itemList}" />
</ice:selectOneMenu>
<ice:dataTable id="pdet" value="#{outerBean.nestedClassList}" var="nestedObject" rendered="true">
<ice:column>
<f:facet name="header">Order Number</f:facet>
<ice:outputText value="#{nestedObject.orderNumber}" />
</ice:column>
<ice:column>
<f:facet name="header">Qty</f:facet>
<ice:inputText value="#{nestedObject.qty}" id="qty" label="'Qty' FOR 'Order Number':#{nestedObject.orderNumber} "
partialSubmit="true"
valueChangeListener="#{nestedObject.qtyChanged}"
validator="#{nestedObject.validateQty}">
</ice:inputText>
</ice:column>
</ice:dataTable>
</h:form>
</h:view>
public class OuterBean{
private List<String> itemList = new ArrayList<String>();
private String selectedItem;
private List<NestedClass> nestedClassList = new ArrayList<NestedClass>();
public OuterBean(){
//init values
}
public void itemListValueChanged(ValueChangeEvent e){
selectedItem = (String)e.getNewValue();
//reset the dataTable record list
nestedClassList = getRandomRecords();
}
//---getters-setters-----//
private class NestedClass{
private int orderNumber;
private int qty;
NestedClass(){
orderNumber = generateOrderNumber();
qty = getRandomQty();
}
//-----qtyChangedListener----//
//-----qtyValidator----------//
//-----getters-setters-------//
}
}