Java Servlets
web.xml
, so
init parameters cannot be used for him. <env-entry> <!--> <description>Send pincode by mail</description> <!--used as part of the JNDI lookup--> <env-entry-name>mainPincode</env-entry-name> <!--default value--> <env-entry-value>false</env-entry-value> <!--the FQDN of the entry--> <env-entry-type>java.lang.Boolean</env-entry-type> </env-entry>
<ejb-ref> <description>Cruise ship cabin</description> <ejb-ref-name>ejb/CabinHome</ejb-ref-name> <!--Entity or Session: type of EJB component--> <ejb-ref-type>Entity</ejb-ref-type> <home>com.titan.cabin.CabinHome</home> <remote>com.titan.cabin.Cabin</remote> </ejb-ref>then the servlet can get a reference to it with:
InitialContext initCtx = new InitialContext(); Object ref = initCtx.lookup("java:comp/env/ejb/CabinHome"); CabinHome home = (CabinHome) PortableRemoteOject .narrow(ref, CabinHome.class);
66 of 89