You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

This application will take you through the basics of Stateless Session Bean. This application will demonstrate how annotations like @Stateless, @Resource, @PostConstruct, @PreDestroy are used in an EJB3 application.

The application walks through a authentication page, where the user has to authenticate to move to the home page of Apache Geronimo. In case a new user, the user has to go through the registration process. Later the user will be directed to login page again once the registration is done. In the login page the bean class will check for the username and password entered by the user against a database.

To run this tutorial, as a minimum you will be required to have installed the following prerequisite software.

  • Sun JDK 5.0+ (J2SE 1.5)
  • Eclipse 3.3.1.1 (Eclipse Classic package of Europa distribution), which is platform specific
  • Web Tools Platform (WTP) 2.0.1
  • Data Tools Platform (DTP) 1.5.1
  • Eclipse Modeling Framework (EMF) 2.3.1
  • Graphical Editing Framework (GEF) 3.3.1

Details on installing eclipse are provided in the Development environment section.
This tutorial is organized in the following sections:

Creating a Stateless Session EJB project

  1. Right Click under the Project Explorer and Create a EJB project as shown.





  2. On the next screen give the project name as StatelessSessionEJB.





  3. Right Click on ejbModule and create a new Interface RegisterBeanRemote





  4. On the New Java Interface window give the package name as statelessejb and Interface name as RegisterBeanRemote





  5. Populate the RegisterBeanRemote interface with the following code.
    RegisterBeanRemote.java
     
  6. Right Click on StatelessSessionEJB project and create a new class RegisterBean as shown in the figure





  7. Populate the class RegisterBean with the following data
    RegisterBean.java
     
    Next we will try to understand the code

This completes the development of EJB project.

Creating a database using Administrative Console

  • No labels