Please see below a demonstrative code snippet being ConversionRate as the object to be edited or created and the CurrencyFrom and CurrencyTo are the object attributes of ConversionRate that will be implemented as SelectOneChoice:
<af:selectOneChoice value="#{bindings.findConversionRateByIdIterator.currentRow.dataProvider.currencyFrom}" label="CurrencyFrom" required="true" id="soc1" autoSubmit="true"> <f:selectItems value="#{myBackingBean.currencyItems}" id="si1"/> </af:selectOneChoice> <af:selectOneChoice value="#{bindings.findConversionRateByIdIterator.currentRow.dataProvider.currencyTo}" label="CurrencyTo" required="true" id="soc2" autoSubmit="true"> <f:selectItems value="#{myBackingBean.currencyItems}" id="si2"/> </af:selectOneChoice>The trick on this is the "currentRow.dataProvider" thing. Replace the "findConversionRateByIdIterator" above with your own applicable iterator.
Please see below a dummy backing bean class to enforce illustration of the idea:
package blogspot.soadev.view.backing; import java.util.ArrayList; import java.util.List; import oracle.binding.BindingContainer; import oracle.binding.OperationBinding; import javax.faces.model.SelectItem; public class MyBackingBean { private List<SelectItem> currencyItems; public List<SelectItem> getCurrencyItems() { if (currencyItems == null) { List<Currency> currencyList = getCurrencyList(); currencyItems = new ArrayList<SelectItem>(); for (Currency currency : currencyList) { currencyItems.add(new SelectItem(currency, currency.getCode())); } } return currencyItems; } public List<Currency> getCurrencyList() { //findAllCurrencies is methodAction binding return (List<Currency>)getOperationBinding("findAllCurrencies").execute(); } public OperationBinding getOperationBinding(String operation) { BindingContainer bindings = (BindingContainer)JSFUtils.resolveExpression("#{bindings}"); return bindings.getOperationBinding(operation); } } class Currency { private String code; private String description; public void setCode(String code) { this.code = code; } public String getCode() { return code; } public void setDescription(String description) { this.description = description; } public String getDescription() { return description; } } class ConversionRate{ private Currency currencyFrom; private Currency currencyTo; private Double rate; public void setCurrencyFrom(Currency currencyFrom) { this.currencyFrom = currencyFrom; } public Currency getCurrencyFrom() { return currencyFrom; } public void setCurrencyTo(Currency currencyTo) { this.currencyTo = currencyTo; } public Currency getCurrencyTo() { return currencyTo; } public void setRate(Double rate) { this.rate = rate; } public Double getRate() { return rate; } }