OAF_開發系列19_實現OAF對話框提示dialogPage(案例)

20150716 Created By BaoXinjianjava

1、摘要web


Oracle dialogPage是OAF提示框的一種用法,具體應用例如在刪除數據時,提示用戶進行確認是否能夠刪除post

 

2、實現方法測試


在CO中添加以下方法
spa

public void processFormRequest(OAPageContext pageContext,OAWebBean webBean) { super.processFormRequest(pageContext, webBean); //跳出提示框
   if ("Delete".equals(pageContext.getParameter(EVENT_PARAM))){
//提示框信息初始化 OAException mainMessage
= new OAException("Delete The Employee Information,Please Confirm?"); OADialogPage dialogPage = new OADialogPage(OAException.WARNING, mainMessage, null, "", ""); dialogPage.setOkButtonItemName("DeleteYesButton"); dialogPage.setOkButtonToPost(true); dialogPage.setNoButtonToPost(true); dialogPage.setPostToCallingPage(true); dialogPage.setOkButtonLabel("Delete"); dialogPage.setNoButtonLabel("Cancel"); //傳遞參數給提示框 Hashtable formParams = new java.util.Hashtable(1); formParams.put("empNum", employeeNumber); formParams.put("empName", employeeName); dialogPage.setFormParameters(formParams);
pageContext.redirectToDialogPage(dialogPage); }
//提示框提示確認後,進行刪除資料,資料刪除後提示數據已被刪除
else if (pageContext.getParameter("DeleteYesButton") != null) { String employeeNumber = pageContext.getParameter("empNum"); String employeeName = pageContext.getParameter("empName");
    Serializable[] parameters = { employeeNumber };
    OAApplicationModule am = pageContext.getApplicationModule(webBean);     am.invokeMethod("deleteEmployee", parameters); //資料刪除後提示信息 MessageToken[] tokens
= { new MessageToken("EMP_NAME", employeeName) }; OAException message = new OAException("AK", "FWK_TBX_T_EMP_DELETE_CONFIRM", tokens, OAException.CONFIRMATION, null); pageContext.putDialogMessage(message); } }

 

3、運行測試code


Step1. 點擊需刪除記錄的資料
orm

Step2.  提示框顯示是否須要刪除blog

 

Thanks and Regardstoken

相關文章
相關標籤/搜索