I have one doubt i am using HFSJ book for my preparation as per that book MVC is existing from day one came along with internet my doubt is that we have model-1 and model-2 i have read in some places that MVC is part of model-2 and not model-1 when MVC existed from day one how can this happen first thing? and one more thing is that on which design patternStruts frame work is based on? in the HFSJ book when they are describing the MVC pattern they have introduced Struts frame work; in the next page they have told that Struts Actionservlet is based on Front Controller Pattern now i am confussed is struts based on MVC or Front Controller Pattern?
My next Question is that how many design pattern should we have to know for the real exam because even though only six patterns are covered in the HFSJ book there is one question that is based on Composite delegate pattern does that mean we should know more than six or only these?
Struts is based on MVC design pattern. The requests are processed by ActionServlet(Controller): in struts, the controller uses Front Controller desgin pattern. The view is composed by JSP's, ActionForms, etc .. The model can be implemented using business delegates, service locators, etc..
Struts is build from different components, that includes action servlet (servlet that receives invocations from forms), XML config file, data validity classes etc. These components are based on the FRONT CONTROLLER, so if you read about the front controller pattern you will find components that builds it and you will be able to match then to the mention components.
Action servlet is one of the components used to build a strut and it is based on MVC.
Are there more than 6 patterns on the exam? This is answered in the ScwcdFaq. Look for the question near the bottom: Why am I seeing Design Patterns in mock exams that aren't in the objectives?
What's this MVC is old/new Model 1/Model 2 stuff? MVC used to be a pattern that could be implemented for each and every UI component (like a button, textfield, or dropdown). It was a strategy for splitting components into three seperate parts to make them easier to code and maintain.
Years later we were making web application where the entire web side was made up of JSPs. This meant we were cramming all kinds of icky logic into scriptlets that were difficult to code and maintain.
Then, all of a sudden, someone magically realised that if we split up our JSP ickiness into multiple, more manageable pieces, life becomes a lot easier. Then someone said, "Wow, this was a good idea. It actually reminds me of a pattern we used to use for our itty-bitty UI components called MVC."
Then folks realized they didn't have a name for the old icky way of doing JSPs. So they decided to call the old way Model 1 and they called the new, MVC, way of doing things Model 2. icky JSPs = Model 1 MVC webapps = Model 2
Somewhere through history some folks started muddying the terms MVC and Model 2 together into the term: MVC 2... so you might come across that term too.
So the "MVC" pattern got reused in a new context: Web Applications. Fortunately for you, this is the only kind you need to worry about for the exam.
Is Struts MVC or Front Controller? It follows MVC and has a Front Controller to help it out. MVC and Front Controller have a special relationship - they're so hand-in-hand that a lot of people get these two mixed up in exam questions. Anyway, pretty much every MVC framework has a Front Controller... kind of like how every big business has a receptionist. It's not a one-or-the-other deal. The two exist together quite nicely.