我有一个托管Bean,它可以更改属性值并调用弹出窗口。 我还需要提交所做的更改(不必单击提交按钮),我尝试了一些代码,但是它什么也没做。 请帮帮我。
DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
OperationBinding operationBinding = bindings.getOperationBinding("Commit");
operationBinding.execute();
答案 0 :(得分:0)
您可以使用以下函数以编程方式提交对Iterator的更改(例如,在动作侦听器中):
public static ViewObjectImpl getViewObjectFromIterator(String nomIterator) {
ViewObjectImpl returnVO = null;
DCBindingContainer dcb = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
if (dcb != null) {
DCIteratorBinding iter = dcb.findIteratorBinding(nomIterator);
if (iter != null) {
returnVO = (ViewObjectImpl)iter.getViewObject();
}
}
return returnVO;
}
private void commit(String IteratorName) {
ViewObject vo = this.getViewObjectFromIterator(IteratorName);
try {
vo.getApplicationModule().getTransaction().validate();
vo.getApplicationModule().getTransaction().commit();
} catch (ValidationException e) {
String validationErrorMessage = e.getDetailMessage();
//Occur when some committed data is rejected due to validation error.
//log it : log(Level.WARNING, " " + validationErrorMessage);
}
catch (Exception e) {
//Log it and warn something unexpected occured
}
}
//In your action listener simply call the commit function as follow
//You can Find YOUR_ITERATOR_NAME the your PageDef Binding file in the Executables Column
commit("YOUR_ITERATOR_NAME");
查看更多:https://gist.github.com/CedricL46/04570c1f078583321ad680ee8ba28f72