Page 1 of 1

About Question com.enthuware.ets.scwcd.v5.2.516 :

Posted: Sun Apr 03, 2016 8:15 am
by mroger
Hi,

"central-controller": In MVC wouldn't we have several controllers? (When I read contral-controller, I understand that there is only one). Isn't that the main difference between MVC and Front Controller?

Nice mocks, BTW.

Thanks,
Marcos.

Re: About Question com.enthuware.ets.scwcd.v5.2.516 :

Posted: Mon Apr 04, 2016 10:07 am
by himaiMinh
MVC: when the model updates its data, the controller (eg servlet) will notify the view. Or, when the view updates its data, the controller notify the model.
Front controller: the front controller (eg servlet) dispatches requests to other resources (eg. other servlets or jsp), so that tasks can be delegated to other resources.

Re: About Question com.enthuware.ets.scwcd.v5.2.516 :

Posted: Mon Apr 04, 2016 3:45 pm
by mroger
Hi, thanks for your reply! :)

Ok, I understand what you said.

But the statement:
"central controller" : Applies to both MVC and Front Controller.
means that when we have only one controller (servlet), we have MVC or Front Controller applied.

"central-controller" isn't the same as one controller (servlet) that makes all the dispatches? In this case, MVC does not apply, does it?

Regards,
Marcos.

Re: About Question com.enthuware.ets.scwcd.v5.2.516 :

Posted: Mon Apr 04, 2016 5:14 pm
by himaiMinh
Yes. The central controller is the single location where all requests and responses are handled.
According to Charles Lyon's study guide p. 632:
MVC pattern:
- an object model which represents a real-world construction. This is the model for the application...

- An AWT or Swing GUI to provide the user with interaction capabilities. This makes up the view....

- Listeners to provide a communications link between what the user does with the view, and how the model responds. This comprises the controller, which is a layer responsible for receiving events fired by the users' interaction with the view, and make changes to the model accordingly.
On p. 633
Patterns for the presentation tier
Front controller
Some application are best maintained if they provide a common central gateway through which all requests and responses pass. Using a central component to handle all requests and responses provides a single location from which to control all logic decisions relating to security, content retrieval and view management. In this pattern, a single component knows as the front controller moderates all request and responses, either for one region of the site or for the entire site....
Since the front controller usually represents a logic processor, it is best implemented with a servlet. All URLs which this front controller is required to handle are mapped to this servlet in the deployment descriptor. The servlet may then delegate processing to other resources based on the format and validity of the request URI....

After reading these two paragraphs, in my opinion, the central controller is applied to MVC's listener and front controller.
Other reference:
http://www.oracle.com/technetwork/java/ ... 35648.html

Re: About Question com.enthuware.ets.scwcd.v5.2.516 :

Posted: Mon Apr 04, 2016 5:55 pm
by mroger
Thank you for your reply and for the link! :)

It was really helpful to read about the Filter Controller Strategy.

Regards,
Marcos.

Re: About Question com.enthuware.ets.scwcd.v5.2.516 :

Posted: Mon Apr 04, 2016 10:29 pm
by admin
Thank you, himai :)