- Advantages of CMP Entity Beans over BMP Entity Beans
- CMP 2.0 Entity Bean Sample Application
- Step 1: Implementing the CMP 2.0 Address Entity Bean
- Step 2: Implementing the CMP 2.0 Roster Entity Bean
- Step 3: Implementing the CMP 2.0 Student Entity Bean
- Step 4: Implementing JSP Clients to Test CMP 2.0 Entity Beans
- Step 5: Packaging the CMP 2.0 Entity Beans as an ejb-jar File
- Step 6: Packaging the JSP As a Web Component
- Step 7: Deploying the CMP 2.0 Entity Bean Sample Application
- Step 8: Testing the Sample Application
- A Discussion of the Deployment Descriptor
- Summary
Step 8: Testing the Sample Application
Now you're ready to test the CMP 20 sample application by creating a student account and several addresses, enrolling the student in some courses, then searching for the student and listing the addresses and courses for which that student is registered.
Open a browser and enter http://localhost:8000/cmp3, as shown in Figure 11-26.
Figure 11-26 Sample application start page
Create a student account. Select the Create New Student link, and the form in Figure 11-27 will appear. Click Submit to create the student account.
Figure 11-27 Creating a student entity
Create two addresses for the student, John Doe. Select the Create New Address link, and in the address create form, fill out the fields with jdoe as the customer ID, 100 as the address ID, 1 Market Street as the street address, San Francisco for the city name, CA for state, and 93456 as the zip code (see Figure 11-28). Click Submit to create the address.
Figure 11-28 Creating addresses
Add another address with the data jdoe, 101, 99 Lake View Ave., Lake Tahoe, CA, 95324 for customer ID, address ID, address, city, state, and zip, respectively. Select the HOME link to return to the start page.
Register the student, John Doe, in couple of J2EE, EJB, and Java classes. Select Create New Roster, and then enter 1001 as the roster ID, J2EE101 as the schedule ID, and jdoe as the student ID (see Figure 11-29). Register for the EJB and Java classesenter 1002, EJB-101, jdoe and 1003, Java-200, jdoe.
Figure 11-29 Registering a student in several classes
Search for student jdoe, then list all his associated addresses and the classes for which he is currently registered. Select the Search For Student link and enter jdoe. The results are shown in Figure 11-30.
Figure 11-30 Result of search