Creating and testing a test client
In this section, we create a JSP client to test the entity bean using a wrapper session bean.
Creating a client
First, we need to create a JSP. Select the EJB3ViewController project and select File>New. In the New Gallery window, select Categories | Web Tier | JSP and Items | JSP. Click on OK.
In the Create JSP window, specify a FileName (EJB3Client) and click on OK.
As we shall be invoking the entity bean, which is in the model project, from the JSP, which is in the ViewController project, we need to add a dependency in the ViewController project on the Model project. Select Tools | Project Properties and select Dependencies. Click on the Edit Dependencies button.
In the Edit Dependencies window, select EJB3Model | Build Output and click on OK, as shown:
The EJB3Model project gets added to the Dependencies. Click on OK, as shown next:
In the JSP client, we look up the session bean and invoke the test()
method on it, which returns a String
. First, we create...