1 2 Previous Next 23 Replies Latest reply on Apr 5, 2004 3:49 PM by krevuru Go to original post
      • 15. Re: I want a simple example of JSP or servlet
        torreblanca

        Sheldon,
        I send you in attachment the uno.ear file (JSP example) and dos.ear (Servlet example)

        Regards
        Javier

        • 16. Re: I want a simple example of JSP or servlet
          torreblanca

          Sheldon,
          I send you in attachment the following files:

          uno.ear (JSP example)
          dos.ear (Servlet example)

          Test it.

          Regards

          Javier

          • 17. Re: I want a simple example of JSP or servlet
            mkithany

            Hi Javier Torreblanca Beltran

            I got your contact informatino from the JBOSS Forum at http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=forums/ have some question with reference to your Reply in the above forum.

            You had given very details information of how to execute JSP and Servlet files. THANKS for that.
            With refernce to Servlet portion of the reply I have some questions:
            1)Why is package com.servlet needed?
            2)Where do I create WEB-INF directory?
            3)Where do I create META-INF directory? What are these directories for?
            4)Where do I execute the JAR commands ofr WAR and EAR?

            Thanks!

            Manoj G. Kithany
            manojkithany@yahoo.com

            • 18. Re: I want a simple example of JSP or servlet
              mkithany

              Hi Javier Torreblanca Beltran

              You had given very details information of how to execute JSP and Servlet files. THANKS for that.
              With refernce to Servlet portion of the reply I have some questions:
              1)Why is package com.servlet needed?
              2)Where do I create WEB-INF directory?
              3)Where do I create META-INF directory? What are these directories for?
              4)Where do I execute the JAR commands ofr WAR and EAR?

              Thanks!

              Manoj G. Kithany

              • 19. Re: I want a simple example of JSP or servlet
                torreblanca

                Manoj,
                Here is the answers:

                1)Why is package com.servlet needed?

                I only use the com.servlet package because I want to structure my application. You can create your servlet class without package.

                For the next questions, let me to say you something:

                You need to follow the JSP/Servlet specification because Sun Microsystems defines standards, and EAR Structure (Enterprise Archive), WAR Structure (Web Archive) and JAR Structure (Java Archive) belong to that specification.

                The JAR file contents your EJB classes and XML configuration files.

                The WAR file contents your JSP, Servlets and XML configuration files.

                The EAR file contents your JAR file, WAR file and XML configuration files.

                The subdirectory structure is

                MyApp /
                META-INF /
                application.xml
                src /
                -your java source code (EJB and servlets)
                -your java classes (bytecodes) (EJB and Servlets) with their package structure
                META-INF /
                ejb-jar.xml
                jboss.xml
                WEB-INF /
                classes /
                your java classes (bytecodes) (EJB and Servlets) with their package structure


                JSP files

                For example :


                JSP project.


                MyApp /
                uno.war
                uno.ear
                src /
                uno.jsp
                uno.war
                META-INF /
                application.xml


                Servlet project

                MyApp /
                dos.war
                dos.ear
                src /
                Dos.java
                dos.war
                com /
                servlet /
                Dos.class
                WEB-INF /
                classes /
                web.xml
                com /
                servlet /
                Dos.class
                META-INF /
                application.xml

                2)Where do I create WEB-INF directory?

                See the before explanation.

                3)Where do I create META-INF directory? What are these
                directories for?

                See the before explanation. Note: There are two META-INF subdirectories. The first one contents ejb-jar.xml and jboss.xml. The second one contents application.xml. You use ejb-jar.xml and jboss.xml files when you have Enterprise Beans.
                The META-INF subdirectory and WEB-INF subdirectory content XML configuration files and bytecodes(EJB and Servlets) of your system.

                4)Where do I execute the JAR commands ofr WAR and EAR?

                - When you create your JAR file you need change to directory

                MyApp\src

                - When you create your WAR file you need change to directory

                MyApp\src

                - When you create your EAR file you need change to directory

                MyApp

                and copy the JAR file and WAR file to MyApp subdirectory.

                You can to automate this building process using Ant.

                Regards

                Javier.

                • 20. Re: I want a simple example of JSP or servlet
                  torreblanca

                  Manoj,
                  I saw my last reply and I don´t see the correct subdirectories structure because the JBoss front-end eliminates the line indent.
                  I send you again the reply but this time I send you in attachment (Subdirectories.txt).

                  Regards

                  Javier

                  • 21. Re: I want a simple example of JSP or servlet
                    siegfried1

                    Thanks Javier,

                    These samples have been very useful. I'm glad I had marked this page.

                    I hope someone will put these in the quick start guide.

                    (1) Where is the contents of these xml files documented? I've looked in a lot of tutorials and have not found a single explanation. Most tutorials just use that deploytool which never lets you know what is going on.

                    (2) Where is the WEB-INF/web.xml for the JSP? I notice that when I deploy I see a message that says missing web.xml file. However, it seems to work fine. When I use the deploytool from the reference implementation it creates a web.xml file.

                    Siegfried

                    • 22. Re: I want a simple example of JSP or servlet
                      siegfried1

                      Thanks,
                      (I hope I'm not posting twice, I posted but don't see my message).

                      I hope this finds its way into the quick start.

                      (1) I notice that the JSP is missing a WEB-INF/WEB.xml file. Why?

                      Siegfried

                      • 23. Re: I want a simple example of JSP or servlet
                        krevuru

                        Joel,
                        I tried to develop a very small application using the way you suggested but I am getting a Mapping Configuration error.
                        This is my Folder Structure C:\JBoss\server\default\deploy\
                        And beneath that I have a Test1 Folder where I have my Test1.JSP, so it is somewhat like:
                        C:\JBoss\server\default\deploy\test1\Test1.jsp
                        So I tried to access the Page and it does not come up. On the JBoss console I see a Mapping Configuration Error. What is this all about? I am a newbie and would really appreciate any help.
                        Thanks,
                        Krishna

                        "joelvogt" wrote:
                        step 1, write a j2ee app
                        step 2, put it in jboss/deploy

                        If you want a simple app, make a directory foo.war in jboss/deploy and put a jsp foo.jsp inside.

                        Your foo.jsp can have the following text :

                        foo

                        then go to http://localhost:8080/foo/foo.jsp

                        and you will see the message foo.

                        I can include these files as an attachement if you don't want to write the foo.jsp yourself.


                        1 2 Previous Next