6 Replies Latest reply on Dec 18, 2001 12:13 PM by David A. King

    "Simple" EJB/JSP/Servlet app example?

    Phil Shrimpton Newbie

      Hi,

      I have managed to get JBoss, Tomcat and Apache all set up and working well 'individually', but want to set them all up to work together. I have got Tomcat/Apache working together, its just JBoss to do.

      Are there any simple example 'apps' available to download that contain EJB's, JSP's and Servlets, or should I go straight to trying out the PetStore example?

      Keep in mind I am fairly new to all this EJB, and 'admin' stuff (but not new to programming in general)

        • 1. Re:
          Jon Newbie

          I'm hesitant to reply because I too am new to this, but have created a couple of EJBs successfully, and have plenty of JSP / Servlet experience (I think we are in the same boat).

          There are two big differences between JSP / Servlets and EJBs that I think will help answer your question.
          1) EJB Applications are DEPLOYED, not just copied into a virtual directory somewhere.
          2) J2EE Containers receive requests for EJB's, NOT WEB SERVERS. As a matter of fact, you don't even need a web server to run an EJB.

          With that said, it is common for EJB requests to come from a JSP / Servlet page running on a web server.

          I would suggest working through a tutorial, and getting an ejb working. Once you understand the DEPLOY step, the two main differences listed above will then make more sense to you, and your question should then be answered.

          • 2. Re: Re:
            Phil Shrimpton Newbie

            Hi,

            "With that said, it is common for EJB requests to come from a JSP / Servlet page running on a web server.

            I would suggest working through a tutorial, and getting an ejb working"

            I am fairly happy that I know the difference between EJB's/JSP's/Servlets, and I have worked through the tutorials etc. of both Tomcat and JBoss and all seam to be working and understood. The main thing that I am missing, both in understanding and examples, is putting them all together. That is, getting a JSP and/servlet "talking" to an EJB.

            I have found a number of complex examples, but I have yet to find a 'hello world' example with an example of what goes where (which libraries in which directories and why etc.)

            Cheers

            Phil

            • 3. Re: Re:
              hamish carpenter Newbie

              try:
              http://www.kevinboone.com/webapptut.pdf

              it is complete but unfortunately the source code downloads don't work. I started out by doing this then turning it into a phone listing.

              haytona

              • 4. Re: Re:
                Phil Shrimpton Newbie

                "try:
                http://www.kevinboone.com/webapptut.pdf"

                Looks just what I need, thanks

                Phil

                • 5. Re: Re:
                  Steinar Overbeck Cook Newbie

                  I'm heading same way as you :-) Just started coding my first WEB/JSP/EJB application, I've been programming for 20+ years, but Java and J2EE is new to me.

                  There is obviously more than one way of doing various things, which is rather confusing at times. I have found the patterns at SUNs site to be very helpfull ( http://developer.java.sun.com/developer/restricted/patterns/J2EEPatternsAtAGlance.html ) in addition to the various patterns at http://www.theserverside.com.

                  I found the examples supplied with JBoss to be very good and much, much easier to understand than the enormous Pet Shop stuff.

                  My number one issue just now is how to ensure that I design the interaction between the web application and the EJBs so that I get maximum performance and scalability. I'm currently going down the path of using Value Objects for interaction between the JSPs and "Facade" session beans.

                  • 6. Re: Re:
                    David A. King Newbie

                    Hi, a good starter example using JSP/Tomcat && JBOSS
                    is located at http://www.stardeveloper.com . Look
                    at the J2EE Section on Creating your first EJB App..


                    The tutorial successfully shows how to call an EJB deployed on JBoss from an JSP page residing in a Tomcat
                    Application Context..