Does MVC determine how one controller should interact with another?

I mean the general MVC design pattern (as defined on Wikipedia ). When running an application that heavily uses the graphical interface, I usually had many controllers, and sometimes the controller could send an event to another controller.

Does MVC generally determine how the controller should interact with the controller? Can a controller be a model for a controller higher in the hierarchy?

Example Suppose I have a window (which is represented by a controller / model / view), and this window is capable of launching another auxiliary window. The sub-window is modal and will accept a specific input. The input affects some processes in the main window.

+4
source share
3 answers

No. You cannot do this with MVC. You want to use some kind of hierarchical template, for example, one of the following two:

+2
source

No controller can be a model for another controller. Controllers can simply pass arguments via Get or Post.

0
source

Accessing the Wiki Model-View-Controller (MVC) is an architecture that separates the presentation of information from user interaction with it.

With that said, it does not define any event mechanism, so there is no specification for communication within the controller.

Now to your question.

You can view the visualization from one controller and transfer data to another controller. this should work fine.

define the form using <form action = "parentcontroller/parentaction"> to make this happen.

0
source

Source: https://habr.com/ru/post/1383018/


All Articles