The Model-View-Controller paradigm applied to web applications lets you separately display code (for example, HTML and tag libraries that is rendered to the end users) from flow control logic (action classes that performs the required operations on the data) from the data model (data persisting inside the relational databases) to be displayed and updated by the application.
The basic idea of the MVC architecture is to divide the application into three layers: Model that represents the data layer, a view layer that represents the data processed by the model component; and a Controller component that is responsible for interaction between the model and the controller.
In the context of web application developed in java when implemented with MVC architecture is aggregated as the struts framework. Many versions of struts have been released till now. The latest version of struts is 2.3.x. Struts framework is the open source framework from the Apache Software Foundation.
Struts Components :
1. The Controller :
This receives all incoming requests. Its primary function is the mapping of a request URI to an action class selecting the proper application module. It’s provided by the framework.
2. The struts-config.xml File:
This file contains all of the routing and configuration information for the Struts application. This XML file needs to be in the WEB-INF directory of the application.
3. Action Classes:
It’s the developer’s responsibility to create these classes. They act as bridges between user-invoked URIs and business services. Actions process a request and return an ActionForward object that identifies the next component to invoke. They’re part of the Controller layer, not the Model layer.
4. View Resources:
View resources consist of Java Server Pages, HTML pages, JavaScript and Style sheet files, Resource bundles, JavaBeans, and Struts JSP tags.
5. ActionForms:
These greatly simplify user form validation by capturing user data from the HTTP request. They act as a “firewall” between forms (Web pages) and the application (actions). These components allow the validation of user input before proceeding to an Action. If the input is invalid, a page with an error can be displayed.
Model Components:
The Struts Framework has no built-in support for the Model layer. Struts supports any model components:
1. JavaBeans
2. EJB
Related Posts...
Mobile AppsTechnologies
Dec 5th, 2024
Mobile applications have transformed the way we live, work, and interact with the world around us. From facilitating seamless communication to enhancing shopping experiences and revolutionising healthcare, mobile apps have […]
Read more
Dec 3rd, 2024
The travel industry is witnessing a significant transformation powered by artificial intelligence (AI). By integrating AI into various aspects of travel, companies can deliver seamless, personalised, and efficient services, ultimately […]
Read more
Nov 28th, 2024
The FemTech (Female Technology) industry has emerged as a transformative force, revolutionising women’s health and fitness through technology-driven solutions. With a global market value of $42 billion in 2020, FemTech […]
Read more