UNIT-V The MVC architecture and Struts Framework. Agenda. Introduction to MVC architecture. Introduction to Struts Framework. Anatomy of simple struts Application. Struts-config.xml file. Presentation layer with JSP.
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
Use of the MVC pattern results in separating the different aspects of the application (input logic, business logic, and UI logic), while providing a loose coupling between these elements.
The goal of Struts is to separate the model (application logic that interacts with a database) from the view (HTML pages presented to the client) and the controller (instance that passes information between view and model).
View represents the user view of the application and is responsible for taking the input from the user, dispatching the request to the controller and then receiving response from the controller and displaying the result to the user.
The web application programmer is responsible for writing the model code, and for creating a central configuration file struts-config.xml that binds together model, view and controller.
Requests from the client are sent to the controller in the form of "Actions" defined in the configuration file; if the controller receives such a request it calls the corresponding Action class that interacts with the application-specific model code.
The model code returns an "ActionForward", a string telling the controller what output page to send to the client.
The Controller : This is the heart of the container. Most Struts application will have only one controller that is ActionServlet which is responsible for directing several Actions.
struts.config.xml : Struts has a configuration file to store mappings of actions.
Model : The model is basically a business logic part which takes the response from the user and stores the result for the duration of the process.
View : The view in struts framework is mainly a jsp page which is responsible for producing the output to the user.
Property file : It is used to store the messages that an object or page can use. Properties files can be used to store the titles and other string data. We can create many property files to handle different languages.