I’m trying to better understand the MVC architecture, and which functionality gets separated into which components. I’m thinking about a website that uses tabs to switch a view. The easiest one I can think of is expedia.com’s homepage, where there are several options (like whether you want to book a flight only, a hotel, etc). If you click one option, the relevant parts of the view change to have different options for the user to enter. See here:

Post image

So I’m wondering, in the MVC architecture, are those tabs (maybe buttons?) part of the View itself, or the Controller?

If part of the View, then am I right to say that the Controller sent over all of the information for all of the options, and the View is just choosing what to display when the user clicks a tab? That makes the most sense to me.

A second question regarding this: is it ever possible for part of the Controller to be on the client? If not I suppose this question is moot, since I believe that no http requests are made once a user clicks a tab, and the only time the requests happen is when you hit “search”.

Source link

Write A Comment