Architecture of Struts 1 MVC Framework

In this post we will see the architecture of Struts 1 or work flow of popular mvc framework that is Struts 1. As we know struts 1 is a mvc (Model-View-Controller) based framework which reduces the work of developers to develop a web application. So, one question will come in your mind i.e. What are the elements in Struts 1 that serves as Model-View-Controller rolls ?

Here is the answer :

Model : Models in Struts 1 framework are the java bean classes that extends ActionForm class provided in Struts jars. Model classes holds the state of the internal and external system.

View : Views are web components that are shown to the web browser users. In Struts 1, it can be jsp page or any view render technique such as Tiles.

Controller : Controllers are the components that handles are the requests that comes from users and decides which view is to send back to the use as response. In Struts 1 the controller part is handled by ActionServlet class and a subclass of Action class that is developer defined. The controller may interact with the application specific business logic or some code that persists data in database or with an EJB.

The bellow figure shows the work flow of Struts 1 :

Architecture of Struts 1

Architecture of Struts 1

The following steps shows the work flow of Strust 1 framework :

1. When first time user request comes from the browser, ActionServlet invoked which reads struts-config.xml configuration file and creates configuration objects. struts-config.xml contains information about the FormBeans, that are subclasses of ActionForm, Actions and view that can be send as response to the browser.

2. In the second step ActionServlet instantiate the specified form bean and puts the value of the form attributes, submitted by the browser, to form bean.

3. Then ActionServlet calls the Action class’s execute method, which returns ActionForward instance. ActionForward instance contains the detail of the view to be return as response.

4. ActionServlet renders the view and return to the browser as response.

Related Posts:

Leave a comment ?


  1. Thanks for the amazing info. I find these posts have a lot of material. I canít wait to get a chance to impliment all these great posts. Thank you very much.

  2. Thank you for sharing. Not to many people in your position are so gracious. Your article was very poignant and understandable. It helped me to understand very clearly. Thank you for your help.

  3. You didn’t describe that all requests are going first of all to controller. Controller get some data from models (On the image it is Subclass of action class). DAO is not always being used in this architecture. Model is often works strictly with db.

    • It seems you are not doing an ajax call, the request from browser is send as a normal url call that is why it is showing the result on web page.

Leave a Comment Cancel reply

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


Trackbacks and Pingbacks:

  • Homepage - Trackback on 2012/08/01/ 22:54