Java 将信息从弹出窗口传递到Oracle ADF上的主窗口
我有一个弹出窗口,显示一个包含数据的表格,我可以选择一行,通过按OK按钮,我可以检索表格中所选行的idNo 我想做的是将这个idNo传递给调用弹出窗口的窗口,并更新这个窗口上的outputText 有人能帮我吗 按钮的代码: 按钮的newBean类:Java 将信息从弹出窗口传递到Oracle ADF上的主窗口,java,oracle,popup,oracle-adf,Java,Oracle,Popup,Oracle Adf,我有一个弹出窗口,显示一个包含数据的表格,我可以选择一行,通过按OK按钮,我可以检索表格中所选行的idNo 我想做的是将这个idNo传递给调用弹出窗口的窗口,并更新这个窗口上的outputText 有人能帮我吗 按钮的代码: 按钮的newBean类: public String b1_action() { // Add event code here... System.out.println("Select One Button has been Clic
public String b1_action() {
// Add event code here...
System.out.println("Select One Button has been Clicked");
// Get bindings associated with the current scope, then access the one that we have assigned to our table - e.g. OpenSupportItemsIterator
DCBindingContainer bindings =
(DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding dcItteratorBindings =
bindings.findIteratorBinding("NameView1_1Iterator");
// Get an object representing the table and what may be selected within it
ViewObject voTableData = dcItteratorBindings.getViewObject();
// Get selected row
Row rowSelected = voTableData.getCurrentRow();
// Display attriebute of row in console output - would generally be bound to a UI component like a Label and or used to call another proces
System.out.println(rowSelected.getAttribute("IdNo"));
setOutputText("" + rowSelected.getAttribute("IdNo") + "");
closePopup("p1");
return null;
}
我希望我的函数:setOutputText()
能够在主窗口上更新我的outputText,该函数尚未实现
谢谢
致以最诚挚的问候根据您希望保留值的方式,将“IdNo”置于视图或页面流范围中
//view scope
AdfFacesContext.getCurrentInstance().getViewScope().put("IdNo", value);
//or page flow scope
AdfFacesContext.getCurrentInstance().getPageFlowScope.put("IdNo", value);
在窗口bean中,编写弹出对话框的侦听器:
public void dialogCloseListener(DialogEvent dialogEvent) {
if (dialogEvent.getOutcome().equals(DialogEvent.Outcome.ok)) {
String idNo = AdfFacesContext.getCurrentInstance().getViewScope().get("IdNo");
//now you have the idNo, do whatever you want
}
}
您还可以在调用弹出窗口的按钮或链接中使用returnListener,如中所示