File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Service Layer in J2EE?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Service Layer in J2EE??" Watch "Service Layer in J2EE??" New topic

Service Layer in J2EE??

Manikandan Swaminathan
Ranch Hand

Joined: Aug 10, 2008
Posts: 117
Hi all,

In a simple web application (non EJB) , do we really need a service layer?

We will have the presentation layer which will be the JSP,HTML etc. and then the controller layer which will be a servlet which acts as
interceptor for all the HTTP requests and then the model layer where we will have the business logic coding.

Then finally we have the Integration layer where we have the DAO codings using which we connect to database, run queries and get
back the results.

Given the above scenario, do we really need a service layer??

If NOT, can you please let me know when a J2EE application will need a service layer? Like for eg. if we are using EJB's etc..

Also i am just referring to a simple web application using JSP,Servlets,POJO's,Java etc. Not any struts application etc..

Can anyone please make things clear for me?

Thanks in advance for your help.

Raghuraman G
arulk pillai
Ranch Hand

Joined: May 31, 2007
Posts: 3371
Business Service Layer is to group the use cases that have related goals.


-- Billing Services
-- Customer Services
-- User Services

The Service layer does not neccessarily have to be an EJB. Your service layer decouples the controller from the processing logic. It can manage/translate exceptions between the caller and callee, etc.

[] | [Java job hunting know how] | [Java resumes]
I agree. Here's the link:
subject: Service Layer in J2EE??
It's not a secret anymore!