tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Struts2 > Basic > Introduction

Introduction 

Struts2 is based on WebWork2 web technology and MVC Model 2 Architecture. Its extensible and light weight framework for development of web applications.

  • Model
    Model represents the business data and Actions act as model components in Struts2. It can use persistence technologies such as JDBC, EJB and Hibernate.
      
  • View
    View is responsible for presenting data to the end user. Struts2 supports to represent the same data model using different view technologies such as JSP, Tiles, Velocity and Freemarker. It provides a result type supporting each view technology.
      
  • Controller
    The Controller acts as a mediator between the View and the Model components. It takes the appropriate action based on request. Struts2 Dispatcher Filter acts as a controller component and starts the request processing life cycle. Controller uses navigation rules defined in struts.xml to invoke appropriate action.
Request Processing Lifecycle
  1. The client makes a request to the web application. The client could be a web browser or HTTPClient program
  2. FilterDispatcher configured in web.xml intercepts the request and determines the list of inteceptors and action to be executed from struts.xml by matching URL pattern.
  3. The request is passed through list of interceptors identified in the previous step. Interceptors can stop the request processing chain and return the result string if required.
  4. The action gets executed after all the interceptors are executed. It then returns a result string which determines the view to be rendered.
  5. The Controller uses the result string returned from action to choose the view from struts.xml. It then builds the response and renders back to the client.




 
  


  
bl  br