Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{scrollbar}

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:

Table of Contents

Creating a Stateless Session EJB project

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


    Image Added


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


    Image Added


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


    Image Added


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


    Image Added


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


    Image Added


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

This completes the development of EJB project.

Creating a database using Administrative Console