Meyyappan has posted 101 posts at DZone. View Full User Profile

Struts MVC Architecture Tutorial

06.13.2012
| 121547 views |
  • submit to reddit

The model contains the business logic and interact with the persistance storage to store, retrive and manipulate data.

The view is responsible for dispalying the results back to the user. In Struts the view layer is implemented using JSP.

The controller handles all the request from the user and selects the appropriate view to return. In Sruts the controller's job is done by the ActionServlet.

The following events happen when the Client browser issues an HTTP request.

  • The ActionServlet receives the request.
  • The struts-config.xml file contains the details regarding the Actions, ActionForms, ActionMappings and ActionForwards.
  • During the startup the ActionServelet reads the struts-config.xml file and creates a database of configuration objects. Later while processing the request the ActionServlet makes decision by refering to this object.

When the ActionServlet receives the request it does the following tasks.

  • Bundles all the request values into a JavaBean class which extends Struts ActionForm class.
  • Decides which action class to invoke to process the request.
  • Validate the data entered by the user.
  • The action class process the request with the help of the model component. The model interacts with the database and process the request.
  • After completing the request processing the Action class returns an ActionForward to the controller.
  • Based on the ActionForward the controller will invoke the appropriate view.
  • The HTTP response is rendered back to the user by the view component.

 

Published at DZone with permission of its author, Meyyappan Muthuraman.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Tags:

Comments

Arvind Kumar replied on Wed, 2012/12/19 - 4:24am

 good to start ....struts framework...in easy way


Milan Gada replied on Wed, 2013/01/16 - 5:32am

 Excellent Start for whom who doesn't know anything about Struts...............


Jaime Bahamondes replied on Thu, 2013/04/04 - 8:38am

The topic clearly says: "Struts MVC Architecture Tutorial" so I was hoping to find a tutorial, but I found only a description of what MVC is. Very bad article. Please change the title so that people will not come here thinking about finding a tutorial.

Regards,

Jaime

Muralidhar Nayani replied on Tue, 2014/05/27 - 11:41am

Given Good points on all the files what they do with the diagram. Good explanation. I found entire flow and architecture of Struts  here.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.