0 Replies Latest reply on May 28, 2006 2:28 AM by tsar_bomba

    injecting EJB into a servlet

    tsar_bomba Newbie

      I'm rather new so forgive my ignorance. I've been using JNDI lookup code to get a stub to my SLSBs:

       public static Foo getFoo()
       {
       IFoo foo = null;
      
       try
       {
       //get EJB
       InitialContext ctx = new InitialContext();
       foo = (IFoo)ctx.lookup("earName/FooBean/local");
       }
       catch (NamingException exp)
       {
       exp.printStackTrace();
       }
      
       return foo.getFoo();
       }
      


      Is there (or will there be) a way to simply inject the interface into the web layer (servlet, jsp, etc??)

      i.e.

      @EJB IFoo foo;
      
      .....
      
      foo.getFoo();
      


      I know Seam is out there and somehow helps w/ this, however I'm using Wicket and don't plan to use JSF anytime soon.

      Thanks in advance!