aspose file tools*
The moose likes Servlets and the fly likes mvc architecture Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "mvc architecture" Watch "mvc architecture" New topic
Author

mvc architecture

trinadh reddy
Ranch Hand

Joined: Sep 22, 2005
Posts: 60
please tell me the difference between MVC and MVC-2 architecture
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

I don't think there is a pattern called MVC2 - at least not one I've ever heard of. Where did you come accross the term?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Neil Barriscale
Greenhorn

Joined: Jul 26, 2005
Posts: 2
The difference between the two models is that model 2 uses a dispatcher servlet to route a request to the appropriate jsp. Read the following article for more info
http://www.javaworld.com/javaworld/jw-12-1999/jw-12-ssj-jspmvc.html
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Thats the difference between a model 1 and model 2 architectures. Model 1 is not an MVC architecture, since there is no controller.
Paul Bourdeaux
Ranch Hand

Joined: May 24, 2004
Posts: 783
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
San Man
Greenhorn

Joined: Oct 14, 2005
Posts: 4
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
pulijala hari
Ranch Hand

Joined: May 14, 2005
Posts: 70
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.

regards,
hari
Paul Bourdeaux
Ranch Hand

Joined: May 24, 2004
Posts: 783
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)
  •  
    Don't get me started about those stupid light bulbs.
     
    subject: mvc architecture