NonStop Servlets for JSP System Administrator's Guide
Interoperability of NSJSP With NonStop EJB
NonStop Servlets for JavaServer Pages (NSJSP) System Administrator’s Guide—525644-001
6-4
References to EJB Components
<ejb-ref-name>
The name of the EJB reference. The EJB reference is an entry in the web 
application's environment. The Java2™ Enterprise Edition Specifications 
recommend that this name be prefixed by ejb/. This entry is required.
<ejb-ref-type>
The type of the referenced Enterprise Java Bean™. This entry is required. The 
<ejb-ref-type> element must be one of the following: 
<ejb-ref-type>Entity</ejb-ref-type>
<ejb-ref-type>Session</ejb-ref-type>
<home>
The fully qualified Java class name of the enterprise bean's home interface. This 
entry is required.
<remote>
The fully qualified Java class name of the enterprise bean's remote interface. This 
entry is required.
<ejb-link> 
Specifies that an EJB reference is linked to an enterprise bean in your J2EE 
application package. The value of the <ejb-link> element is the JNDI name 
used to publish the linked Enterprise Java Bean. This entry is optional. 
Example 6-4 is an sample of a servlet accessing the Translator Enterprise Java 
Bean™ deployed in EJB.
Example 6-4. A Servlet Accessing EJB
public class myEJBServlet extends HttpServlet {
 ...
 public void doGet (HttpServletRequest req, HttpServletResponse res)
 throws ServletException, IOException {
 ...
 Context ic = new InitialContext();
 Object objref = ic.lookup("java:/comp/env/ejb/TranslatorWebRef");
 TranslatorHome home = (TranslatorHome) 
 PortableRemoteObject.narrow(objref, TranslatorHome.class);
 System.out.println("\nTranslating 'Hello' into the Hindi language:");
 System.out.println( translator.translate("Hello", "Hindi") );
 ...
 } /* End of the doGet method. */
 ...
} /* End of class myEJBServlet. */










