Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mvc architecture

 
trinadh reddy
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please tell me the difference between MVC and MVC-2 architecture
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Neil Barriscale
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
San Man
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
  •  
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic