I try understand architecture MVC for a Java Web App, I am doing a project where I try implement it. But I have a doubt. I have a HTML form (View) where users input some data. This form will have to send to a servlet (Controller) which updates a Java Bean (Model). At here all fine.
But, what happen when the form input data affects two or more models? How is have to be the controller responsable about manage this models?
Because I think only can exists 1 Controller – for – 1 Model ¿What is the pattern for that?
I would do just the opposite:
1 view has 1 controller and can talk to one or multiple models.It makes sense to me as the model is long living and the views can easily be replaced, but when you replace a view you will have to replace it’s corresponding controller.
In your specific case this means that your
HTMLcan post to aservletthat can process the httpPOSTmade, and communicates this to the different models.