----- Original Message ----- From: "Tom Yang" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: 24, 02, 2003 3:51 PM Subject: JSP/JavaBean compared with EJB
> Hi all: > I've been using TomCat, JSP, JavaBeans to talk to database servers via > JDBC/ODBC and I feel I can do any Web/database related work with the tools I > have, such as generating dynamic Web pages and storing/retrieving data from > different database servers such as Oracle and SQL Server. I didn't use any > J2EE/EJB. > Because it seems EJB is a hot topic and lots of people are using it, I > studied a little about it. So far, I haven't found any advantage of using > it. In fact, I feel several disadvantages of using it: > > 1) You would have to use a heavy weight EJB application server such WebLogic > or WebSphere, which are kind of more difficult to learn and certainly more > expensive to buy than using just a light weight servlet/JSP engine like > TomCat. > > 2) When you use EJB, you would have to follow the strict rules of > programming, such as defining the interfaces for each EJB. With just using > JavaBean, you don't have this problem. > > 3) Each Entity Bean corresponds to a database table. When the database table > is changed, such as adding/renaming/deleting columns, the corresponding EJB > file would also have to be changed. Compared with using just a JavaBean to > do the database work, the changes involved will be minimal - usually, just > changing the SQL statements querying the table. > > 4) Deploying the EJB is certainly much more complicated than deploying the > JSP/JavaBean files in TomCat. With the former, you have to go through all > the steps creating the .jar, .war, .ear files and define the jndi names > etc., while with the latter all you need to do is just drop the files into > the correct folder. > > 5) With using the EJB, the .ear file created for one application server > often doesn't work with another application server (I tried to put the .ear > file which works for one EJB application server onto another application > server and it didn't work. Other people had similar experiences like mine). > I ended up having to re-create the .ear files for the new application server > which cost me quite a bit of time. However, with using just a servlet > engine, I would think you can just move the source code to the correct > folders if you change the engine and it will work. > > 6) I heard people say "EJB provides almost transparent scalability". What > does "scalability" mean exactly? Does it mean when the number of > users of my application written using only JSP/JavaBean (without EJB) > increases to a certain point, my application will run into the "scalability" > trouble? If so, what kind of trouble is called "scalability" exactly? > > 7) Another advantage of EJB I heard was "transaction management". Why do I > need that? I can use JSP/JavaBean to issue all kinds of SQL statements and > commit or rollback any transaction as needed. Why do I need EJB's > "transaction management"? > > 8) Another advantage of EJB I heard was "security". My application currently > uses username and passwords to authenticate users. If the user provide the > correct username and password, then he/she can access the Web page. If not, > then he/she cannot access the Web page. Is this kind of authentication > inferior to the one EJB would provide? > > Having said above, my questions are: > > Is there anything EJB can do but using just JSP/JavaBean cannot? What are > the advantages of using EJB compared with just using just JSP/JavaBean? Why > are people so enthusiastic about using EJB? So far, I feel I can do anything > without using EJB and I do feel using EJB just complicates the work > unnecessarily. I'm sorry if my questions sound naive because my experience > with using EJB is very limited. Thank you all for your answers to my > questions in advance! > > Tom > > _________________________________________________________________ > The new MSN 8: smart spam protection and 2 months FREE* > http://join.msn.com/?page=features/junkmail > > =========================================================================== > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". > > Some relevant archives, FAQs and Forums on JSPs can be found at: > > http://java.sun.com/products/jsp > http://archives.java.sun.com/jsp-interest.html > http://forums.java.sun.com > http://www.jspinsider.com > =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".