What is Controller in MVC ?
Is it struts.xml
or Servlet
(Action Class)?
Can we have more than one Controller
in our application?
Is it good practice to have more than one controller?
The controller component in an MVC application has several responsibilities, including receiving input from a client, invoking a business operation, and coordinating the view to return to the client.
Struts is an open source framework that extends the Java Servlet API and employs a Model, View, Controller (MVC) architecture. It enables you to create maintainable, extensible, and flexible web applications based on standard technologies, such as JSP pages, JavaBeans, resource bundles, and XML.
Front Controller is StrutsPrepareAndExecuteFilter. It uses the concept of RequestProcessor class while processing request. It uses the concept of Interceptors while processing the request. It has only JSP for the view component.
Struts 1 is based on Servlets. It has one ActionServlet that acts as its controller.
In Struts, application Controller layer code/functionality is split into two parts:
ActionServlet
with RequestHandler
Action
classesActionServlet
acts like FrontController pattern.
Image from this OnJava article.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With