MVC isn't the only pattern Struts uses. If you for example uses Struts 2 it uses the FrontController pattern wich is a helper pattern for MVC.
It uses Service To Worker pattern internally, Intercepting filter pattern and some more I guess.
When using tiles with Struts you are in fact using the Composite View pattern. When you build your model you probably will be using the Session Facade pattern, Data Access Object pattern and some more.
Read about them at Sun [ June 07, 2007: Message edited by: Mathias Nilsson ]
Joined: Jul 06, 2006
Thanks for your comments!!
I remember in one interview i was asked what is a difference between Front Controller and MVC pattern. I never thought about it and I answered that Front Controller has only one controller which takes user input/requests whereas in MVC you can have several controller (thought this is not recommended). Is that correct?
I am new to Struts as i said, and i am reading programming in jakarta Struts and finding it ok but not sure if that book was designed for newbies considering.
Please let me know which book to read (i am use to head first series where lot of things are explained using daigrams...) so that concepts of Struts are clear.
Joined: Aug 21, 2004
I think that the Front Controller helps you not to write scriplet code in the JSP view. A Front Controller typically uses an Application Controller, which is responsible for action and view management.
The front controller is in struts 2 a Filter that functions as a Dispatcher for the action and views. The acion collects data and the Dispatcher forwards to the view. To preserve the Service To Worker pattern we don't want the action to be aware of the view. The dispatcher let's the action know to collect data and then forwards to JSP or other views.
If you find a good book on Struts 2 then please let me know. I'm looking for one
Joined: Jan 06, 2007
I tried going through struts on the struts website and wiki and it was a pain!!! It's so scatter-brain, I thought it was pretty bad. Anyway I did find this link through it all and this download is pretty well written and goes through the basics of Struts 2 and how to get things done, once you go through this you'll have a good foundation for the new framework.
From my opinion Struts 1.x also using Front Controller, since it is only using 1 servlet (ActionServlet) as controller. Then the controller will dispatch all the incoming requests to the apropriate Action class. You can read about Front Controller pattern here java.sun.com/blueprints/corej2eepatterns/Patterns/FrontController.html