There is a big difference between a school page and a professionally developed Web site. The page designer (or
HTML developer) must understand colors, the customer, product flow, page layout, browser compatibility,
image creation, JavaScript, and more. Putting a great looking site together takes a lot of work, and most Java
developers are more interested in creating a great looking object interface than a user interface. Java Server
Pages (JSP) technology provides the glue between the page designer and the Java developer.
If you have worked on a large-scale Web application, you understand the term change. Model-View-Controller
(MVC) is an approach put together to help control change. MVC decouples interface from business logic and
data. Struts is an MVC2 implementation that uses Servlets and JSP tags, from the J2EE specifications, as part
of the implementation.

Model-View-Controller (MVC)
MVC helps resolve some of the issues with the single module approach by dividing the problem into three
    The model contains the core of the application`s functionality. The model encapsulates the state of the application.
    The view provides the presentation of the model. It is the look of the application. The view can access the model getters, but it has no knowledge of the setters. In addition, it knows nothing         about the controller. The view should be notified when changes to the model occur.
    The controller reacts to the user input. It creates and sets the model.

MVC Model 1


The Model 1 architecture is very simple. A request is made to a JSP or servlet and then that JSP or servlet handles all responsibilities for the request, including processing the request, validating data, handling the business logic, and generating a response.

Consequences of the single-page approach

Heavy HTML and Java coupling
The coder of the JSP file must be both a page designer and a Java developer. The result is often either terrible Java code or an ugly page, or sometimes both.
Java and JavaScript blur
As the pages become larger, there can be a tendency to implement some JavaScript. When the JavaScript appears in a page, the script can get confused with the Java code. An example of a possible point of confusion is using client-side JavaScript to validate the email field.
Embedded flow logic
To understand the entire flow of the application, you have to navigate all of the pages. Imagine the spaghetti logic on a 100-page Web site.
Debugging difficulties
In addition to being ugly to look at, HTML tags, Java code, and JavaScript code all in one page makes it difficult to debug problems.
Tight coupling
Changes to business logic or data means possibly touching every page involved.
Visually, in large pages, this type of coding looks messy.

JSP Tags: No more Java code in my HTML
A JSP tag is simply a way of abstracting out code from a JSP file.

Intro MVC struts

JSP tags solved only part of our above listed problems. We still have issues with validation, flow control, and updating the state of the application. This is where MVC2 comes to the rescue.

MVC Model 2


In this MVC architecture, a central servlet, known as the Controller, receives all requests for the application. The Controller then processes the request and works with the Model to prepare any data needed by the View (which is usually a JSP) and forwards the data to a JSP. The JSP then uses the data prepared by the Controller to generate a response to the browser. In this architecture, the business and presentation logic are separated from each other. Having the separation of business and presentation code accommodates multiple interfaces to the application, be they Web, wireless, or GUI (Swing). Additionally, this separation provides excellent reuse of code.

Note – Model 1 (single page approach) and Model 2 (true MVC approach), so don’t be confuse if you asked for MVC model 1, you need to explain single page approach.