Skip to content

Topic 6: Enterprise JavaBean (EJB) components

Zhamri Che Ani edited this page Jun 6, 2026 · 2 revisions

Goal

To introduce students to Enterprise JavaBeans (EJB) as server-side components used to manage business logic in enterprise applications.

🎯 Learning Objectives

Students should be able to:

  1. Explain the concept of JavaBeans and Enterprise JavaBean (EJB)
  2. Differentiate between JavaBean and EJB
  3. Describe the types of EJB (Session, Entity, Message-Driven)
  4. Understand the role of EJB in enterprise architecture
  5. Apply simple JavaBean concepts in web applications

📌 Topics to Cover

  1. Introduction to JavaBean
    • What is a JavaBean
    • Properties (getter & setter)
    • Naming conventions
  2. JavaBean in Web Applications
    • Using JavaBeans with JSP
    • Passing data between components
  3. Introduction to EJB
    • What is EJB
    • Why use EJB in enterprise systems
  4. Types of EJB
    • Session Bean (business logic)
    • Entity Bean (database representation – concept only)
    • Message-Driven Bean (MDB) (asynchronous processing – concept only)
  5. EJB in Architecture
    • Placement in multi-tier architecture
    • Integration with Servlet and JSP

🛠️ Hands-on Activity (Tutorial)

Activity: Using JavaBeans in Student Management System

Students are required to:

1. Create JavaBean Class

Example: Student.java

Attributes:

  • name
  • email
  • program

Include:

  • Getter and Setter methods

2. Use JavaBeans in Servlet

  • Create object:
Student s = new Student();
  • Set values:
s.setName(name);
  • Pass to JSP:
request.setAttribute("student", s);

3. Display in JSP

  • Access using Expression Language:
${student.name}
${student.email}
${student.program}

4. (Conceptual EJB Understanding)

  • Students explain:
    • Where a Session Bean would be used
    • Where MDB might be used (e.g., email notification system)

Expected Output

Students should produce:

  1. JavaBean class (Student.java)
  2. Updated Servlet
  3. JSP page displaying object data
  4. Simple explanation of EJB types

📚 Suggested Readings

  1. Oracle JavaBeans Tutorial https://docs.oracle.com/javase/tutorial/javabeans/
  2. Introduction to EJB https://jakarta.ee/learn/docs/jakartaee-tutorial/current/entbeans/ejb-intro/ejb-intro.html
  3. https://en.wikipedia.org/wiki/Jakarta_Enterprise_Beans
  4. https://www.tutorialspoint.com/ejb/ejb_overview.htm
  5. https://www.geeksforgeeks.org/java/enterprise-java-beans-ejb/
  6. https://medium.com/@upadhyay068/everything-you-need-to-know-about-enterprise-javabeans-ejb-features-types-and-rmi-9c8da700e86a

Clone this wiki locally