Thursday, February 13, 2014

OADialogPage message in controller extension in oaf

The below code perform based on some condition and invokes warning message and user click OK button to proceed further

   if (oapagecontext.getParameter("paApply")!=null)
   {
String msg = " ";
MessageToken tkns[] = null;
msg = oapagecontext.getMessage("XX","XX_ADJ_MSG",tkns);
OAException message = new OAException(msg);
OADialogPage dialogPage = new OADialogPage(OAException.WARNING, message, null, "",null);
dialogPage.setOkButtonItemName("SaveYesButton");
dialogPage.setOkButtonToPost(true);
dialogPage.setOkButtonLabel("Ok");
oapagecontext.writeDiagnostics(this,"setPostToCallingPage: ",6);
dialogPage.setPostToCallingPage(true);
       oapagecontext.redirectToDialogPage(dialogPage);
    }

---Always add the handle as separate if condition
if (oapagecontext.getParameter("SaveYesButton")!=null)
{
System.out.println("Continue");
oapagecontext.writeDiagnostics(this,"Continue: ",6);
oapagecontext.writeDiagnostics(this,"paApply: "+oapagecontext.getParameter("paApply"),6);
oapagecontext.putParameter("paApply", new String("paApply"));
oapagecontext.writeDiagnostics(this,"paApply1: "+oapagecontext.getParameter("paApply"),6);
super.processFormRequest(oapagecontext, oawebbean);
}