20150716 Created By BaoXinjian
一、摘要
Oracle dialogPage是OAF提示框的一种用法,具体应用例如在删除数据时,提示用户进行确认是否可以删除
二、实现方法
在CO中添加如下方法
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);}
}
三、运行测试
Step1. 点击需删除记录的资料
Step2. 提示框显示是否需要删除
Thanks and Regards