Hi Sanjeev,

here is a small example how to call Session EJB:


<%@ page import="
com....myEJB.*,
...
"
%>

<%!
public  myEJBHome getMyEJBHomeInterface(){
    MyEJBHome  home = null;
    try {
        // Contact the MyEJBean container through JNDI.
        Context ctx = getInitialContext();
        if (ctx == null)        {
            /* error */
         }
         home = (MyEJBHome)ctx.lookup("myEJB.myEJBHome");
         if (home == null)       {
                /* error */
          }
                // Catch any exceptions
     }
    catch (Exception e) {
            e.printStackTrace();
      }
      return home;
}
 public Context getInitialContext(){
...
}
%>
...
<%
MyEJBHome home = getMyEJBHome();
MyEJB ejb = home.create();
...
ejb.remove();
%>

(assuming that your ejb is deployed and is sitting in JNDI tree under 
"myEJB.myEJBHome")
Galina.





SANJEEVMITTAL <[EMAIL PROTECTED]>@INF.COM> on 02/04/2000 03:15:26 AM

To:   [EMAIL PROTECTED]
cc:

Subject:  Calling EJBs from JSP. How?


Hi All,

How can we call EJBs from JSP without using any other bean/servlet? If
possible, please post some sample code as well.

TIA,

Sanjeev

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to