Friday, 12 January 2018

How to get the Name of all Objects and their Run time Value in Running OAF page to use in the controller Extension



In Friends , In this post I will share you the trick in OAF by which you can know the internal names of all objects which is existing in you OAF page beside this you can also get their values which is initializing during run time in OAF page.


When we need to perform controller extension and put some custom code in the OAF page we need to know the internal names of the object which is working for this page and we also need to get the values which are initialing during run time of the oaf page to understand its architecture and to help in Debugging also.

You have to run this code under Process Request so that when page load you will get all ID/Name of the object for this page.


 public void processRequest(OAPageContext pageContext, OAWebBean webBean)

{
  super.processRequest(pageContext, webBean);


       OAApplicationModule am = pageContext.getApplicationModule(webBean);


 String parameterName;

// This below code will get the name of all the objects of OAF page as a Parameter.

 Enumeration e = pageContext.getParameterNames();


// This below code will print the name of the objects and their values in sequence

      while(e.hasMoreElements())
      {
              parameterName = (String)e.nextElement();

        System.out.println( "Parameter Name=>" + parameterName + " Parameter Value=> " + pageContext.getParameter(parameterName));     
     
              pageContext.writeDiagnostics(this, "Parameter Name=>" + parameterName + " Parameter Value=> " + pageContext.getParameter(parameterName),2);

}

}



If you doing any controller Extension but you have no idea about the page layout and don't know the name of the Objects and their values then my recommendation is You have to put this code first and then know all the things about this page and then set conditions as per your business requirement.


 

0 comments:

Post a Comment