- Controller will take care of the web browser activities.
- The controller 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.
- When we create controller on subclass will generate.
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 example while loading the page displaying the default items.
Process Form Request: This method will handle HTTP post.After loading the page if we want to perform any actions then we go for process form request.
Process Form Data: This page is invoked upon a browser ‘post’. During this phase the framework will automatically applies changes back to the underlying view objects. Rarely custom code is required in this phase. If exceptions are thrown during this phase the phase is skipped and the page redisplays with the error message.
There are two parameters in the controller:
- 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 and many more.
- 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.