Controller servlet?

Hi there!

I am re-writing a web application using design patterns, actually for learning DP.

I am using JSP at front end. I have this doubt, which hopefully you experienced guys have answers for.

1. I have a Controller class (servlet), which calls a appropriate Action class when some action takes place at view.

view -> Controller -> Action -> Model (business logic)

My doubt here is, does Controller (servlet) fall into any of the design patterns group? It does an useful job of instantiating and calling appropriate action class and thereby decoupling view and model.

Thanks very much

-Mahi

[652 byte] By [mahi18a] at [2007-9-28 11:03:03]
# 1
Apparently, this seems to fall under the group of GRASP patterns.-Mahi
mahi18a at 2007-7-12 1:20:36 > top of Java-index,Other Topics,Patterns & OO Design...
# 2

It is a Front Controller (a J2EE pattern):

http://developer.java.sun.com/developer/restricted/patterns/FrontController.html

http://java.sun.com/blueprints/patterns/FrontController.html

I do not think that an applicable GoF pattern exists. J2EE patterns are pretty big patterns; they are more like building blocks for applications and provide solutions to very concrete problems. I suppose GoFs could be called "micro patterns" because they are so small (and abstract) and usable for a variety of purposes.

And, of course, probably your architecture is a server-side implemenation of the infamous Model-View-Controller pattern. (Model = business logic/data, View = JSP, Controller = controller servlet)

aritta at 2007-7-12 1:20:36 > top of Java-index,Other Topics,Patterns & OO Design...
# 3

> It is a Front Controller (a J2EE pattern):

Thanks for the information aritt!!

> And, of course, probably your architecture is a

> server-side implemenation of the infamous

> Model-View-Controller pattern. (Model = business

> logic/data, View = JSP, Controller = controller

> servlet)

yes it is! But isn't MVC a Framework rather than a pattern?

- Mahi

mahi18a at 2007-7-12 1:20:36 > top of Java-index,Other Topics,Patterns & OO Design...
# 4
This is just a variant of command pattern probably with the composition of few other patterns. Give a viewpoint this way you will be able to sketch the whole construct - Karthicraja
karthicrajaa at 2007-7-12 1:20:36 > top of Java-index,Other Topics,Patterns & OO Design...
# 5
> isn't MVC a Framework rather than a pattern?MVC is used in J2ee as an architectural Pattern, a Framework is an implementation [of a Pattern] so JPS or Struts are frameworks thay apply the MVC to the J2ee Platform.
MartinS.a at 2007-7-12 1:20:36 > top of Java-index,Other Topics,Patterns & OO Design...