This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes OO, Patterns, UML and Refactoring and the fly likes Design Patterns Front Controller vs Page Controller Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Design Patterns Front Controller vs Page Controller" Watch "Design Patterns Front Controller vs Page Controller" New topic

Design Patterns Front Controller vs Page Controller

Jawahar Rajan
Ranch Hand

Joined: Feb 28, 2002
Posts: 38
I am on a project team dedciding weather to use a Front End Controller or a Page controlled in the MVC that we are setting up.
The application will be Web Facing and will employ a wizard to help users navigate. Hence the tendency may be towards a Front end controler, rather than a Page Controller. But Front Controller seems rather complex and page controller requires seprate controller for each page. this inturn effects security.
what would be some condsiderations when make such a decisions
Any help is appreciated
Kyle Brown
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
Use a framework that provides a Front Controller like Struts. It should be WAY past the point where we are building our own versions of these patterns now.

Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at for other WebSphere information.
Ken Krebs
Ranch Hand

Joined: Nov 27, 2002
Posts: 451
A good alternative to Struts to get the Front Controller behavior without having to write a lot of plumbing code is to use the more flexible MVC webapp portion of the lightweight frameworks provided by Spring. In Spring webapp MVC, you can declare a number of DispatcherServlets in your web.xml and each one can have a different strategy for resolving how URL's are mapped to Controllers that process the information from the HttpRequest.
Using this technique, all your url mappings and the wiring of your application components are declared in hierarchically organized configuration files. Spring's lightweight JavaBean container infrastructure handles wiring up your application components.
You can also use its AOP infrastructure to configure proxies/interceptors to handle your security infrastructure and transactions declaratively without having to resort to EJB.
The Petclinic sample webapp shows how all this is done in its configuration files, web.xml, applicationContext.xml, and petclinic-servlet.xml.

kktec<br />SCJP, SCWCD, SCJD<br />"What we observe is not nature itself, but nature exposed to our method of questioning." - Werner Heisenberg
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
There could be such a thing as a dead simple front controller with a bunch of command pattern objects. The logic might be as primitive as

This is not a "feature rich" solution, but does just about the least possible work to delegate requests to appropriate commands.

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I agree. Here's the link:
subject: Design Patterns Front Controller vs Page Controller
It's not a secret anymore!