Javabean vs. Servlets?
I'm curious.... and maybe I can't get a direct answer. But, what really is the difference when using Javabeans and Servlets? Is there an advantage?
From what I can understand, they do pretty much the same thing. The only difference is, Javabeans are accessed via a JSP, and servlets are accessed directly from the web server.
Is this correct?
[370 byte] By [
ajpaxson] at [2007-9-26 1:18:40]

Aaron,
First off....I assume that you are actually curious about EJB, not Javabeans. Javabeans are a type of class, EJB is a framework for distributed transactional computing that uses JavaBean classes to accomplish its work.
I would advise that you stick with servlets for now. Servlets seem to enjoy much broader use among Java programmers. EJBs require a lot of overhead for the sake of reusable code...which is probably not ever as reusable as you'd like it to be.
You should be able to do everything you want to do using servlets alone. Once you have mastered the servlet, you are also by default a master of JSP. So concentrating on servlets pays off in the long run.
Randy
heh heh.... Thanks for the "real-world" answer!!
Yeah, I thought of JavaBeans being a class that I can use when needed.
I just didn't want to deal with all the "out.println" statements to generate the HTML code. :-)
But, alas... if servlets are getting the wider acceptance... far be it for me to be an outcast. <grin>
well, from your answer, I'm guessing you *do* mean javabeans and *not* EJB, as rloffelm assumed. In which case, there's a different answer...
look at these threads:
http://forums.java.sun.com/thread.jsp?forum=45&thread=142441
http://forums.java.sun.com/thread.jsp?forum=45&thread=81044
and read this (*very* good reading!)
http://www-106.ibm.com/developerworks/library/j-struts/
Awesome, Matt!
Thanks for the reference materials. You understood better than most. Unfortunately, I was not able to pull those documents from my search, (since I always do a search before posting). <sigh> Oh well! They do really help!
I've heard of Struts, but never really read into it. But, if it will help me in my understanding... I'll do it! It looks to be a Great article!
Thanks for the response!!
Aaron