An airline sells tickets online.It first allows customers to select their airport, input a destination and a departure time; a servlet processes this result, but must access an EJB application in order to create a list of all suitable flights before forwarding to a JSP view, which two patterns combined would be best implemented here?
B. service locator
C. business delegate
D. transfer object
The answer is C and D.
A delegate provides a uniform way to access to EJB data, while a transfer object is used to transfer details about all available flights at the same time. B in incorrect , as although the web application may use a service locator for convenience, the other two patterns (transfer object and business delegate) provide the significant interface with EJB.
I think service locator can be one of the options as well. The business delegate can use service locator to look up the EJB. The business delegate can use the EJB returned from the service locator. Then, the business delegate can use the EJB application.