File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Design Patterns Front Controller vs Page Controller

 
Jawahar Rajan
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Jawahar
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ken Krebs
Ranch Hand
Posts: 451
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jawahar,
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.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic