1.
File à new
project.

2.
In new project select javaEE à Enterprise application, then select
next button.

3.
On clicking next button, a dialogue box
appears asking us to enter project name.
Enter the project name as “Test1” and click next.

4.
Another dialogue box appears asking us to
choose the server and after choosing the server click the finish button.

5.
Right click on “Test1-ejb”, a menu pops out in
which we choose new à session
bean.

6.
A dialogue box will appear in which we give
the ejb name as “TestEJB” and select the interface as remote and click finish
button.

7.
After clicking the finish button a page with
title TestEJB will appear, on the page perform right click operation and select
“Insert codeà Business
method”.

8.
A dialogue box appears in which we change the
return type as String.


10.
Right click Test1.waràNewàServlet.

11.
In that give the class name as “TestServlet”
and package as “Servlets” and click on finish button.


Add these Header file
import java.io.*;
import javax.ejb.EJB;
import javax.servlet.*;
import javax.servlet.http.*;
import stateless.TestEJBRemote;
12.
In the Servlet page, right click à Insert code à Call Enterprise bean à TestEJBà Ok.
13.
In the same page change all the
“processRequest” into “goGet” .
14.
Change the sixth “out.println“ statement into
“out.println(TestEJBBean.getMessage())”;.

15.
Clean and build the project then execute the
project.

No comments:
Post a Comment