Difference between Java Beans and EJB


EJB design: Difference between Java Beans and EJB

  1. Difference between Java Beans and EJB (2 messages)

    Hi JAVA Programmers....!

    I want to know the difference between EJB and JAVA Beans.

    When we need to use EJB and JAVA Beans.

    Can i get example on both of these i.e. EJB and JAVA Bean.

  2. JavaBeans:-
    Basically used to CUSTOMIZE EXISTING OBJECTS. i.e. You can
    create USER OBJECTS, which are based on existing objects.
    For Example: 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.
    For Example: 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
  3. java bean[ Go to top ]

    there is know different a java bean an enterprisejavabean

      both are component only ejb saves as alot of time in netwoking etc,only bussiness logic v have to write it