This page contains an archived post to the Java Answers Forum made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
Artima Forums.
Message:
Difference between EJB and Java Beans.
Posted by Sandeep Thool on December 28, 2001 at 5:40 AM
JavaBeans --------- Basically used to CUSTOMIZE EXISTING OBJECTS. i.e. You can create USER OBJECTS, which are based on existing objects. Ex.: A default button operates as a Single-State Switch. i.e. when you press a button on a web page, it doesn't remain pressed. Infact, it immediately bounces back to its OFF state like a Door-Bell. Now, let's say, you need a button, which should have 2 stable states, like the typical Electrical Light Switch. So, in this case, what you can do is, take an existing button (having 1 stable state) and CUSTOMIZE it so that it has 2 stable states. This is possible using JavaBeans. Enterprise Java Beans (EJB) --------------------------- EJB is a completely different concept than the one mentioned above. It is NOT used to customize existing objects. Instead they are basically used to STANDARDIZE the way, in which business logic is written. Ex.: We can write our business logic as well as the GUI logic, inside Servlets/Applets/StandAlone applications itself. But this way,there will be no clear distinction between the Code that is responsible for the GUI and the actual Business logic code, because everything is written inside the same class file. So, to COMPONENTIZE we write business logic in seperate class files than the GUI logic, thereby making a clear distinction between the reponsibilities.
Replies:
|