File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes OO, Patterns, UML and Refactoring and the fly likes Question on MVC object creation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Question on MVC object creation " Watch "Question on MVC object creation " New topic

Question on MVC object creation

Barry Brashear
Ranch Hand

Joined: Jun 05, 2001
Posts: 303
I have a question on how the objects in an MVC pattern are created. Does another controller open all three - model, controller and views. Or, does
another controller open your controller, then your controller open the model and views. I'm thinking in terms of a large application that has many

Suman Mummaneni
Ranch Hand

Joined: Dec 14, 2004
Posts: 87
I do not think you can have many mvcs in one application. The application as a whole must follow the MVC principle.

Suman Mummaneni
Sarath PS

Joined: Oct 22, 2004
Posts: 11
I think we can have multiple front controllers in a single web application.
Deepak Shankar

Joined: Dec 14, 2005
Posts: 12
I believe We can have multiple controller instances in an application. For example, in business deligate pattern, we can define the same controller class by making the entry in web.xml(thereby a new instances for every business deligate will be created by the server).


Please correct me if I am wrong.
Deepak Shankar

Joined: Dec 14, 2005
Posts: 12
To answer Barry's question,
There is no specific rule that controller should create model and model should create a view etc. It is based on the framework.

If you take web applications, the controller "create" model instances and "invoke" view instances. In this case I have said "invoke" because the control is forwarded to the web container for creating the view instance. What the controller can do is just say response.forward() or response.redirect().

And generally we do not instantiate one controller from another controller.

Hope this helps.
I agree. Here's the link:
subject: Question on MVC object creation
Similar Threads
Is this MVC ?
MVC question
Relationship between Model, View and Controller
doubt in design patterns
MVC - How Did You Do It?