Thư viện tri thức trực tuyến
Kho tài liệu với 50,000+ tài liệu học thuật
© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Writing Enterprise Applications with Java™ 2 SDK, Enterprise Edition phần 5 pdf
Nội dung xem thử
Mô tả chi tiết
LESSON 3 COOPERATING ENTERPRISE BEANS
46 SEPTEMBER 27, 2000
Change the Session Bean
In this lesson and as shown in Figure 14, the entity bean is a client of the session bean. This
means the entity bean gets its data from the session bean instead of from BonusServlet as it
did in Lesson 2 A Simple Entity Bean (page 27). So, the calcBonus method in the session
bean is modified to take the social security number as a parameter and create the entity bean.
Figure 14 Beans Working Together
CalcHome
The CalcHome interface is unchanged. It has the same create method that returns an
instance of the remote interface.
package Beans;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.EJBHome;
public interface CalcHome extends EJBHome {
public Calc create()
throws CreateException, RemoteException;
}
Session Bean
(Application Server)
calcBonus method
getRecord method
Database
HTML Form
Browser
bonus.html
Servlet
(Web Server)
BonusServlet.class
Entity Bean