• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Service Layer in J2EE??

 
Manikandan Swaminathan
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Cheers,
Raghuraman G
 
arulk pillai
Author
Ranch Hand
Posts: 3387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Business Service Layer is to group the use cases that have related goals.

Example:

-- 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic