Understanding the MVC architecture is important for powerful web applications built with Struts By Peter Varhol
Struts is an item of Jakarta, which provides a method that can use JavaServer Pages (JSP) and servlets together in a web application. Its purpose is to resolve inherent issues in applications that are completely implemented by JSP or completely by servlet. For example, Servelts can generate an HTML page, but it is very troublesome. On the other hand, JSP can be easily used in the traditional HTML page, but the JSP page has other shortcomings. In particular, it is difficult to use JSP to separate the contents of the content. It is easy to mix the Java code with HTML, and what makes it makes slow and difficult to maintain.
However, because JSP pages are easy to use, they become the preferred method of building a dynamic web application with Java. In addition to easy programming, the JSP page is also improved, so they now overcome some of the previous limitations. JavaBeans and tag libraries are only several improvements in the foundation JSP technology. This type of method -JSP page is separately responsible for processing the request and reply client - called Model 1 architecture.
JavaServer Pages are special circumstances of servlets, so both can work together to make up for each shortcomings, which seems to be logical. This type of method - your web architecture contains distant but interconnected data patterns, display code and program control logic JSP and Servlet components - called Model 2 architecture, or Model-View-Controller MVC) architecture.
In order to use the Struts architecture and programmed with JSP and Servlets, the understanding of the MVC architecture is necessary. The main difference between Model 1 and MVC architecture is where the request is processed. In the Model 1 architecture, requests are received through JSP, mainly through JSP processing. If the JSP page requires services from any other application component, such as a database, then you will properly call from the page, return the data to the page, schedule data format and display it. You can put some code in one or more JavaBeans, but do not have logic to completely separated the logic.
The MVC method uses the best features of the JSP and Servlet methods, so that both technologies can work together. Clearly, servlet is a processing layer (controller). The servlet receives the request, which is very similar to the JSP page in the Model 1 architecture and determines how to meet those requests. This means that the request and output of the servlet control input.
(Note: Related questions about Struts can be in contact with me: Tech@ee-studio.com PHP framework for Structs mode, please see the demo item in www.ee-studio.com Eurekaenergy3.0)