Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB v/s servlet(Very urgent pls help)  RSS feed

 
saahil sinha
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have an application tht i got to develop.A part of the application deals with gettin information from the client and inserting it into a database also providing facility to view the info and edit the info to the administrator of the application .Now this editing,viewing,inserting of data can be for different types of clients like a propreiter,partner etc.
Now what i would like to know is how should i implement the back end operations like insertion,updation and viewing of data should i pass form elements from a servlet to EJB and perform all operations in the EJB or perform all database operations in servlet or should i use custom tags to perform the operations.Is it possible to use custom tags to retreive all form elements and perform back end operations.If yes how do i use custom tags to take form elements from the form and pass it into custom tags and then from custom tags insert into database.
The requirement is very urgent so i would be very grateful for a quick reply.Thanx.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
PLEASE don't do backend operations in custom tags. That's a horrible way to do things -- it totally confuses model and view, and makes debugging incredibly difficult.
Instead, either use a DataAccessObject from your Servlet directly, or use EJB's. I think you need to sit down and read a basic book on EJB's to determine whether or not you need them -- there are several conditions under which they are useful, but the long and the short of it is that if you're only ever going to use a single database, and have a single client type, then they're probably not needed.
A good book for you to read is Martin Fowler's "Patterns of Enterprise Application Architectures" which explains how to write DAO's to access back-end data and explains some of the tradeoffs in detail.
Kyle
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!