aspose file tools*
The moose likes Servlets and the fly likes Mediator View VS. Service to worker Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Mediator View VS. Service to worker" Watch "Mediator View VS. Service to worker" New topic
Author

Mediator View VS. Service to worker

Neha Sharma
Ranch Hand

Joined: Jul 13, 2001
Posts: 126
Hi,
Can anybody suggest me what is the major pluses and minuses of mediator view and service to worker kind of architecture. Though I know the difference architecturily, that in the mediator view the request is dispatched to the JSP and then the JSPs do the business logic by interacting with Java beans or EJBs, while in service to worker kind of architecture the servlets does the business processing and JSPs are used for presentation. Mine is a small project with 8-10 JSPs. I'm pushing hard for the mediator view architecture but one of the guys in the team wants it to be done using service to workers. Suggestions please.
Thanks
Neha
Vlad Patryshev
Ranch Hand

Joined: Jun 30, 2001
Posts: 61
Both ways sound not quite right to me. Why not place all the logic in the beans? My opinion is that servlets are for redirection, jsps are for presentation, and all the rest is done inside beans, is not this correct?


Thanks,<br />Vlad
Manjunath Reddy
Ranch Hand

Joined: Jul 26, 2001
Posts: 60

Mediator view is good for a very small Application with not much complexity in the processing. This makes the architecture a kinda Model 2...which was used before the Model 3(MVC) arch. came into practice. Preferably the UI must have as less business as possible and totally de-coupled with the middle-tier for a scalable app. Morover its not good practice to access EJB's in the JSP. Instead ppl generally use DataViewObjects(clones of EJB) to ferry the data betweeen JSP and EJB's.
Seperation of various layers is accomplished with Service to worker architecture. This serves well for both small as well as large sites. Easier to maintain and lot more scalable than the 2-tier architecture. There's a lot of documentation on this @ sun site.
Just to add my 2 cents of experience...i had pretty bad experience over maintainance and enhancements with the Moderator View whereas the Service to Worker(MVC and Struts frameworks) worked well for me.
We actually evolved the controller to be a JSP instead of Servlet(thereby minimizing the compilation and deployment of the controller). This is a kind of hybrid of both the arch. that you have mentioned.
Good luck,
mpr
Neha Sharma
Ranch Hand

Joined: Jul 13, 2001
Posts: 126
Thanks for your replys, but a M. Reddy in the mediator view model also everything is being written in bean just the difference is instead of the JSP calling the bean the servlet calls the bean(as in service to worker model). So my idea was to take away the complexity of writing all the logic in one servlet and write just the forwarding logic in the servlet and the bean calling logic in JSP. But as you said you done it and that's not good. Your idea about using a JSP for controller is great.
Thanks
Neha
Manjunath Reddy
Ranch Hand

Joined: Jul 26, 2001
Posts: 60
>>So my idea was to take away the complexity of writing all the logic in one servlet and write just the forwarding logic in the servlet and the bean calling logic in JSP.
One can further design the controller[servlet/jsp] to be divided into discrete pieces that support a specific functionality. Something akin to loginController, userController, sessionController...etc
chz,
mpr
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Mediator View VS. Service to worker