MVCPPT

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 12

 

J2EE application with implementation of a web-


centric application.

The J2EE platform is designed to provide server-side


and client-side support for developing distributed, multi
tier application
Commonly we separate a web-based application into
three tier architecture.

View layer and Controller layer comes under the


presentation tier, used to interact with the client.

The Business tier deals with business logic and the


data accessing from database.

The Integration tier is a legacy system contains


database like thing.
1. Model-View-Controller (MVC)

Model-View-Controller architecture is used for interactive web-applications.


This model minimizes the coupling between business logic and data
presentation to web user. This model divides the web based application into
three layers:
2. Model: Model domain contains the business logics and functions that
manipulate the business data. It provides updated information to view
domain and also gives response to query. And the controller can access the
functionality which is encapsulated in the model.

2. View: View is responsible for presentation aspect of application according


to the model data and also responsible to forward query response to the
controller.

3. Controller: Controller accepts and intercepts user requests and controls the
business objects to fulfill these requests. An application has one controller for
related functionality. Controller can also be depends on the type of clients.
MAPPING MVC ARCHITECTURE TO J2EE

CLIENT TIER USER INTERFACE HTML/JAVA /APPLET

WEB TIER SERVER SIDE PRESENTATION LAOGIC SERVLET/JSP


HANDLE MAINTAIN STATE BUILD
PAGES

EJB TIER BUSINESS LOGIC EJB


BUSINESS OBJECT AND THEIR RULES

DATA TIER DATA RDMS DIRECTORY


PERSISTENCE BUSINESS OBJECTS
ADVANTAGES OF MVC
1)Support multiple user: there can be different view rendering with
out changing the controller or model implementation

2)Replacement of an MVC component with out rewriting the entire


application

3)Allows for the selection of the best solution for each MVC
component
SIMPLE APPLICATION IMPLEMENTING JAVA SERVLETS AND
JAVASERVER PAGES FROM JAVA EE:

Model
The model is a collection of Java classes that form a software application intended
to store, and optionally separate, data. A single front end class that can communicate
with any user interface (for example: a console, a graphical user interface, or a
web application).

View
The view is represented by a JavaServer Page, with data being transported to the
page in the HttpServletRequest or HttpSession.

Controller
The Controller servlet communicates with the front end of the model and loads the
HttpServletRequest or HttpSession with appropriate data, before forwarding the
HttpServletRequest and Response to the JSP using a RequestDispatcher.
N-Tier Architectures

• Data Tier – manages the data

• Presentation Tier – controls what a user sees and can do with


the system
– We will build several applications within this tier later on

• Business Tier (middle tier) – controls everything else (the


business logic)
BUSINESS TIER

• The business tier contains the core functionality of our


system
– Business rules

– Work flows

• It provides controlled access to data

• It enables validation and processing of data input


Business Tier

• The business tier will be defined using


Classes

• The collection (library) of classes


representing our business tier will be
deployed as a component
Components

• Our component will consist of a collection


of classes developed to fulfill a certain specification

• It can be re-used

• It should encapsulate all its behavior

• It must provide an interface to allow it to


be accessed by a client (could even be another component)
DAOs
• Data Access Objects provide abstract interfaces
to data sources

• DAOs provide a clear separation between our


business and persistence logic

• We want to write robust code and achieve lowcoupling


between our business classes and the
database
– No need to clutter our business logic with SQL code
– No need to rewrite all our business classes if there is
a change in the database

You might also like