SET AS HOME PAGE

ADD TO FAVORITES / BOOKMARK THIS WEBSITE (More Details)

Introduction

Servlet

Jsp

Security

Enterprise Beans

Contact Us


Stateful Session Bean - Complete Project (Continue ...)

 Introduction

Stateful session beans are appropriate if any of the following conditions are true:

  • The bean’s state represents the interaction between the bean and a specific client.
  • The bean needs to hold information about the client across method invocations.
  • The bean mediates between the client and the other components of the application, presenting a simplified view to the client.
  • Behind the scenes, the bean manages the work flow of several enterprise beans.

Types of Enterprise Beans are
  • Session Beans
    1. Stateless Session Beans
    2.  Stateful Session Beans
  • Entity Beans
    1. Bean Managed Persistent (BMP) Entity Beans
    2. Container Managed Persistent (CMP) Entity Beans
  • Message-Driven Bean
CLICK HERE to download this complete example (zip file)


 Steps to deploy and run this Stateful Session Bean Project

  1. Write a java file and name it as CourseHome.java
  2. Write a java file and name it as Course.java
  3. Write a java file and name it as CourseBean.java
  4. Write a jsp file and name it as Index.jsp
  5. Write a jsp file and name it as CourseCart.jsp
  6. Set the path in the command prompt
    set path=.;D:\progra~1\java\j2sdk1.5.0\bin;D:\Sun\AppServer\bin;
    Set classpath=.;D:\progra~1\java\j2sdk1.5.0\lib;D:\Sun\AppServer\lib\j2ee.jar;
    (OR)
    Set the path in the system itself. CLICK HERE for details
  7. Now compile the CourseHome.java, Course.java, CourseBean.java. CLICK HERE to see how to compile
    Note: It is important that this CourseHome.class, Course.class, CourseBean.class files must be placed inside a folder University
  8. After the java programs are compiled successfully, you can close the command prompt.
  9. Now goto Start -> Programs -> Sun Microsystems ->Application Server PE -> Start Default Server (wait till it start and then press any key). CLICK HERE to see how to Start the Server
  10. Next goto Start -> Programs -> Sun Microsystems ->Application Server PE -> Deploytool. CLICK HERE to see how to Start the Deploytool
    Now in the deploytool,
  11. Goto File ->New -> Application

    (Click the Browse button)


  12. (Select the folder in the Look In dropdown box, and then give a file name StatefulBeanExample. Next click the New Application button)


  13. (Click the OK button)
  14. Now goto File -> Save to save the file
  15. Select File->New->Enterprise Bean
  16. Click the Next button
  17. Now give the JAR Display Name as UniversityJAR (Because the package name is University). Next click the Edit button
  18. Now select the Course.class, CourseBean.class, CourseHome.class from the folder University and click the Add button
  19. Now click the OK button
  20. Now click the Next button
  21. Now select University.CourseBean from the Enterprise Bean Class drop-down box. Alos don't forget to change the Enterprise Bean Type to Stateful Session. Select University.CourseHome from the Remote Home Interface drop-down box. Select the University.Course from the Remote Interface
  22. Now click the Next button
  23. Click Finish button

 Click Next To Continue ...
<- PREVIOUSNEXT ->