What is MVC (Model 2) Architecture? Use of Struts Framework for MVC

MVC stands for Model, View, Controller .There are two models are there for building JSP based Web applications. Model 1 & Model 2 . Model 2 is referred to MVC (Model-View-Controller) . The main purpose of the MVC architecture is to separate the business logic and the data from the presentation to the user. (Model- (bean,EJB), View - (Html,Jsp),Controller -(ActionServlet) )

Benefits of MVC : .
They are resuable : Maintenance of large applications are very easy. Suppose if you want to convert your application to support mobile browsing, yuo have to just change the view (JSP) part. No need to change the business logic part as it is seperate.
        1) Model : In the MVC architecture , Model components provide an interface to the data and / or services used by an application. Controller does not have the code for manipulating an applications's data. Instead they communicate with the model components that perform the data access and manipulation. Thus the model component provides the business logic. Model components can be a basic java bean or EJB or Web Services.
           2) View : View Components are used to generate the response to the browser. Example of View Components are JSP or HTML Pages.
             3) Controller : This is the core of MVC. This is a servlet that receives requests for the application and manages the flow of data between the Model components and View Components.

MVC can be implemented by the frame work Struts or Spring

0 comments:

Post a Comment

 
Copyright 2011 Java Online