Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Controller in Struts

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?

like image 475
ajay Avatar asked Nov 03 '09 11:11

ajay


People also ask

What is the role of controller in Struts?

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.

What is Struts controller in Java?

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.

What is front controller in Struts?

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.

Which one is the component of controller in Struts?

Struts 1 is based on Servlets. It has one ActionServlet that acts as its controller.


1 Answers

In Struts, application Controller layer code/functionality is split into two parts:

  • ActionServlet with RequestHandler
  • Action classes

ActionServlet acts like FrontController pattern.

alt text

Image from this OnJava article.

like image 158
cetnar Avatar answered Oct 02 '22 02:10

cetnar