Servlets and JSPs use EJB references to instantiate proxies for EJB home interfaces. See the Enterprise JavaBeans User’s Guide for more information. EJB references must be cataloged in the deployment descriptor so that the Web application can run independent of a specific naming configuration. When deploying the Web application, a site administrator can specify site-specific EJB JNDI names.
Servlets and JSPs can look up an EJB by specifying the reference name prefixed with java:comp/env/. For example, if you enter ejb/catalog in EAServer Manager, use java:comp/env/ejb/catalog in your JSP or servlet source code.
ejb-ref tags include these fields:
Name Specifies the JNDI name used in your code to refer to the
called EJB. The aliased name displays in the Link Value field. Enter
the part of the JNDI name that begins with ejb/
.
For example, if your code refers to java:comp/env/ejb/MyBean,
enter ejb/MyBean
.
Type Choose Session for session beans or Entity for entity beans.
Home The Java class name of the EJB home interface, specified in
dot notation. For example, com.sybase.MyBeanHome
.
Remote The Java class name of the EJB remote interface, specified
in dot notation. For example, com.sybase.MyBeanRemote
.
Link Value The actual JNDI name EJB component that is installed in the server where your component, Web application, or application client is to be deployed. This must match the JNDI name property in the component properties of the called EJB component.
For example, your web.xml file might have an entry similar to this:
<ejb-ref> <ejb-ref-name>ejb/myBean</ejb-ref-name> <ejb-ref-type>Entity</ejb-ref-type> <home>com.sybase.MyBeanHome</home> <remote>com.sybase.MyBeanRemote</remote> <ejb-link>JNDIName</ejb-link> </ejb-ref>