Web tier: servlets, JSP, Web frameworks: Can EJB session beans be called directly from a JSP?

  1. In version 1.1 of JSP can an session EJB be called from
    a JSP, or do I have to call a Javabean to call the EJB.

    I believe I have to call the Javabean.
  2. Yes U can call the EJB Session Bean from JSP.
    Implement same clientcode in JSP.

    Import all packages with JSP import tag like this
    <%@ page import="javax.ejb.*,javax.naming.*,weblogic.jndi.*,<here your package>.*" %>

    <% Environment e=new Environment();
       Context c=e.getInitialContext();
       sampleHome sh=(sampleHome)c.lookup("here your jndi name which you have given xml file";
       sampleRemote sr=sh.create(....); %>

    include your extra code.
    This will help you.

    Ok: Venu Gopal Burra

  3. Hi,
    I'm new to j2ee and i was wondering if somebody can give me one sample each for
    i) calling a servlet from jsp
    ii) calling a session bean from jsp.
    Simple samples like both the servlet and ejb could just be printing "hello world".
    Thanks in advance,