Pages

Layered Application Development in J2EE

In layered designed we use different layer for different task. Each layer interact to other layer using   well defined Interface.

Different layer of J2EE application


Controller layer

This layer contains integration logic. This layer is like supervisor.

This layer receive request from clients, delegate request to Service layer and provide data to View, receive from service layer and return final view to client.


eg : Servlet component

Service layer

This layer contains Business logic or Main logic of application. This layer is like Account officer. Most of the processing is goes here.

Eg: Java classes

Persistence layer


This layer provides persistent logic means contains logic for CRUD operation. This layer is like recordist. It is also called DAO layer. It uses different technology like DB, or simple file to provide persistent layer.

Eg : Java classes

View layer

This layer contains presentation logic. This layer is like beautician.
Uses different technology likes HTML, CSS, JavaScript, JSP


Benefit of Using layered design to develop J2EE application

1. Parallel development of different layer.
2. Easy to maintain separate layer
3. Changes on one layer not affect the other layers.


Client sends data to Controller layer, Controller layer hold this data in VO class and convert VO class to DTO class and passes  DTO to Service layer, Service layer convert DTO to BO and pass it to Persistence layer and vice-versa.

VO      (Value Object class)
DTO    (Data Transfer Object class)
BO       (Business object class)

No comments:

Post a comment