- For OAF technical resource one of the most frequently asked interview question topic is MVC components. Controller is one such components. Lets read about the details of controller with interview perspective.
- Following are the major responsibilities of a controller:
- Controller is responsible for handling users actions on the page.
- It also manages the flow between pages.
- Controller responds to the user actions and directs application flow.
- The controller will request from HTTP get and HTTP post.
- All the controllers end with the CO.
Controllers have three methods:
- Process Request (HTTP get).
- Process Form Request (HTTP post).
- Process Form Data.
HTTP get:This is used while loading the page.
HTTP post: After loading the page if we want changes.
Process Request: This method will handle HTTP get.For example while loading the page displaying the default items.
Process Form Request: This method will handle HTTP post. For instance after loading the page if we want to perform any actions then we go for process form request.
Process Form Data: This method is invoked upon a browser ‘post’. During this phase the framework will automatically apply changes back to the underlying view objects. It is not recommended to customize this method. If exceptions are thrown within this method the phase is skipped and the page re-displays with the error message.
Parameters In Controller:
There are two parameters in the controller:
- OAPageContext
- OAWebBean
OAPageContext:
- This parameter is used to get and set values of the fields using the OAPageContext.getparatmeter and OAPageContext.putparameter.
- To call one page to another page OAPageContext.setforwardURL.
- To redirect the current page itself use OAPageContext.forwardImmediatelyToCurrentPage (or) OAPageContext.sendRedirect.
OAWebBean:
- Each and every field we have properties and the properties define the behavior of item.
- OAWebBean represents the Hierarchy/Structure of the components in the page. WebBean represents the properties of item.
As we discussed what Model, View, and Controller is, look at the below figure which shows that how they generally interact with each other or how the data flow between them is.
Read Other OAF Tutorials:
- How To Debug OAF Pages When Its Going Into Error!!
- OAF Interview Questions And Answers - Part1
- How To Migrate OAF Personalizations To Other Instances
- How to Enable Personalization link On OAF Pages
- How To Create A VO At Run Time In OA framework
- Implement PopList in OA Framework | OAF Tutorials
- How To Call A Concurrent Program From OA Framework Pages
COMMENTS