File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Front Controller and Application Controller Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Front Controller and Application Controller" Watch "Front Controller and Application Controller" New topic
Author

Front Controller and Application Controller

Kate Young
Greenhorn

Joined: Jun 14, 2005
Posts: 18
I am getting confused with the front controller and application controller patterns. If the client clicks on a page to send a request, is it

client-->Jsp-->frontcontroller-->applicationController-->businessDelegate

or

client-->frontcontroller-->jsp-->applicationController-->businessDelegate

I guess the front controller decides what jsp can process the request parameters and the application controller decides what command to use. But who redirects to the next page?
Jose Latrefoliere
Greenhorn

Joined: Jun 22, 2005
Posts: 18
Kate

From Core J2EE patterns:quotes:

"Application Controller

Problem:
You want to centralize and modularize action and view management.

In the presentation tier, there are typically two decisions to be made upon the arrival of each request:

1/First, the incoming request must be resolved to an action that services the request. This is called action management.

2/Second, the appropriate view is located and dispatched. This is called view management.

You can encapsulate action management and view management in different parts of the application. Embedding this behavior within a Front Controller centralizes the functionality, but as the application grows and the code becomes more complex, it's a good idea to move this behavior into a separate set of classes, improving the code's modularity, reusability, and extensibility."
View management is handled by the "Application controller".Try to read this book, it's excellent and ... necessary for part II

Hope this help
Jose
Kate Young
Greenhorn

Joined: Jun 14, 2005
Posts: 18
Jose, I have been reading this book but it does not explain my question. It only talks about the Front Controller delegating to the Application Controller and then the application controller forwarding to the View. But I think in my case the client calls the JSP i.e. when a certain request is sent. In my sequence diagram, I was representing it as the Client sending a request to the JSP. Now I think the client sends the request to the FrontController and it in turn sends it to a response JSP. So there would be no request JSPs!!! Is this correct?
Jose Latrefoliere
Greenhorn

Joined: Jun 22, 2005
Posts: 18
The client sends the request to the FrontController (really, the url corresponding to a link or a button in a page, is mapped to a servlet-the FrontController- in the web application configuration file), this object intercepts all requests.Here you have two choices:
1/The FrontController, processes the request and forwards the response to a JSP, in this case, view management is handled by the Frontcontroller (it may use command pattern, a view Helper and a screen flow manager)
2/A FrontController, (you have a single entry point to your application)only intercepts requests and forwards them to an ApplicationController which extracts data, processes requests (using Command pattern) and handles view management.
There are many benefits with the second alternative.

Hope this help

Jose
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Front Controller and Application Controller