Here i will provide some guidelines, there are many way to access your EJB3 session/entity bean. Also You can use Singlton ServiceLocator(J2EE design pattern) to look up the EJB session bean from the JNDI Naming Server.
So your application flow would be something like this:
JSP (View) -> Servlet (Controller) -> Business Delegate (J2EE Design Pattern) -> Service Locator (J2EE Design Pattern) -> Session Bean (Business Tier)
Example:
EJB3 session bean
Code:
//session interface
package com.myapp;
import javax.ejb.Stateless;
public interface HelloEJB3 {
public String sayHello();
}
//session implementation
package com.myapp;
import java.ejb.Stateless;
@Stateless
@local
public class HelloEJB3Bean implements HelloEJB3 {
private String greeting = “Hello, EJB3!”;
public String sayHello() { return greeting; }
}
Bookmarks