This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
MVC2 is a term coined to describe a web based MVC model. Technically Paul is correct, there is no design pattern named "MVC2". There is just MVC. But if you hear people start talking about MVC2 vs MVC (or even MVC1 :roll: ) they are usually referring to Model 2 vs Model 1 architecture.
Normally, when I hear the term MVC2 used in a design context, it referrs to a MVC pattern in a web application that uses some type of framework such as Struts... but this is by no means a definatation.
“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
Mvc 1 does not contain much interaction between servlets ,jsp and javabeans or ejb
MVc 2 has the best interaction ,u can create instance of bean in servlet and forward the page to jsp jsp should be used only for presentation,shouldn't contain much java code while servlet can contain java code but lot of business logic can be used in DAO
Hello, The MVC Model 1 is driven by Page Centric application. It is suitable for small scale application where you know what would be the next jsp page in each control. Where as MVC Model 2 architecture is not page centric. The total control structure is written down in the struts-config.xml file. This is very much scalable in large applications. Hope this would solve the problem. Correct me if i am wrong.
Joined: May 24, 2004
The total control structure is written down in the struts-config.xml file.
Struts is an example of Model 2 architecture... but it is not the only example. Model 2 and MVC can be found in othe frameworks and other programming languages. Here is an example that has nothing to do with struts:
A request is made for mypage.do.
In the web.xml, mypage.do is mapped to the MyServlet class (controller).
The MyServlet class uses the pojo (plain old java object) MyModel (model) to do some interaction with an underlying database.
Then the MyServlet class adds information to the request scope and forwards the request onto myView.jsp (view)