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 - Example, Continue ...
  1. Next, goto File -> New -> Web Component

    (Click Next button)


  2. (Enter the WAR Name as UniversityWAR because the class package name is University and then click the Edit Contents… button)


  3. (Select only CourseCart.jsp and Index.jsp files and click the Add button)


  4. (Now click the OK button)


  5. (Now click the Next button)


  6. (Now select the JSP Page option button and then click the Next button)


  7. (Now select the Index.jsp from the Servlet Class dropdown box)


  8. (Now select the Next button)


  9. (Now select the Finish button)


  10. (Now select the UniversityWAR in the left pane and select the General tab in the right pane. Here give a name univ_details in the Context Root text box)
  11. Next select the StatefulBeanExample in the left side

    (Now select the StatefulBeanExample in the left pane and then select the Aliases tab in the right pane. Next select the Add button)


  12. (Now add a name as University)

  13. Now select the UniversityWAR in the right pane and then select the EJB Ref’s tab in the right pane
  14. Now click the Add button
  15. In the Coded Name type ejb/Univ (name given as in the lookup()). Select the EJB Type as Session. Select the Interface as Remote. Select the Home Interface as University.CourseHome. Select the Local Remote Interface as University.Course. Now select the Enterprise Bean Name ratio button in the Target EJB as ejb-jar-ic#CourseBean
  16. Now click the OK button
  17. Now goto File ->Save
  18. Next goto Tools -> Deployee

    (Enter the User Name as “admin” and Password as “password” (CLICK HERE for password). Next click the OK button)


  19. (Now a message --- Operation Completed Successfully --- must display. Next click the Close button)
  20. Next goto File -> Exit to close it
  21. Now open the Internet Explorer and type the address http://localhost:8080/univ_details/Index.jsp
  22. Program completed successfully
  23. To stop the server goto Start -> All Programs -> Sun Microsystems -> Application Server PE -> Stop Default Server. CLICK HERE to see how to Stop the Server

 Click for Next Topic
<- PREVIOUSNEXT ->