Newbie
Newbie

Reputation:

Does MVC normally have a separate Controller for every View?

I'm just browsing MVC examples so far, and I think I'm getting a handle on it. For my project - an embedded system on ARM9, no Windows/ASP at all - we are considering doing all the UI as MVC. Does MVC also require a strict Tree of all UI Views (one root?)

Upvotes: 0

Views: 2051

Answers (4)

lohiaguitar91
lohiaguitar91

Reputation: 522

A controller can have many views and partial views. If you take a look at some simple ASP .NET MVC tutorials: http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/intro-to-aspnet-mvc-4 you'll learn how this can be done easily.

Upvotes: 0

idstam
idstam

Reputation: 2878

If your views are parts of a full page you might also use the same view from different controllers. Ie header and footer.

Upvotes: 0

DrFalk3n
DrFalk3n

Reputation: 5006

You can split the controller into a front controller and several actions. As reference see The MVC Pattern as implemented into Symfony framework.

Upvotes: 0

vartec
vartec

Reputation: 134601

No, one controller may have different views for different actions.

Upvotes: 3

Related Questions