facebook

Access Session Bean from Servlet

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #250134 Reply

    Hello,

    I’m very new to J2EE and MyEclipse. To play a bit arround with Session Beans I’ve programmed some and deployed them successfully
    to JBoss 4.0. Now I want to access some Business Methods of my Beans using the local interaface from some Servlet or JSP Pages. How
    can I realize this with MyEclipse? Does it provide some features to achieve this?

    For some information I’m very thankful. 😀

    Kind Regards

    Richard

    #250180 Reply

    Riyad Kalla
    Member

    Richard,
    You will need to create a separate Web Project that adds your EJB project on the build path. Then create an EAR and add both the Web and EJB project as modules to it. From there you should be able to use your EJBs and get autocompletion and such.

    #250253 Reply

    Thanks for your answer.

    So, I’ve e.g. created a Session Bean named UserData with both a local and a remote interfaxe, so Myeclipse generates after running XDoclet some new Classes named

    UserData
    UserDataHome
    UserDataLocal
    UserDataLocalHome
    UserDataUtil

    They all reside in the package net.opgenoorth.efax.ejb.interfaces (the bean class itself is in net.opgenoorth.efax.ejb

    So what do I have to import into my servlet class?

    net.opgenoorth.efax.ejb.interfaces.UserDataLocal???? Or do I have to use UserDataLocalHome?

    Thanks for all Information, because I’m new to J2EE.

    Kind regards

    Richard

    #250282 Reply

    Riyad Kalla
    Member

    Here is some example code of using an EJB from a servlet or JSP page. It is referring to the Jonas app server, but the techniques will still apply: http://www.redhat.com/docs/manuals/rhaps/jonas-guide/s1-webdev-servbeans.html

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Access Session Bean from Servlet

You must be logged in to post in the forum log in