5 Replies Latest reply on Sep 7, 2008 8:03 AM by Jose Alvarez de Lara

    Load index.jsp as welcome file

    Jose Alvarez de Lara Novice

      Hi all again,

      I am working with an application that counts then number of total entries on the server as well as the number entries of those in my DB.

      I use a JSP as welcome file (index.jsp) that is included into the web.xml.

      To count the total entries in the server I use a Session Bean and for any particular entry of the members of the application I use an Entity Bean

      I control all from a Servlet that call both Session and Entity Bean and response to the index.jsp entry.

      The index.jsp is a form with a textbox and a submit button.

      It is working but does not doing what I want. It is just a question of debugging. My problem is when I write the URL on the browser, I mean,

      http://localhost:8080/entrada/index.jsp

      the browser shows me the response of the servlet. The application passes over the index.jsp going to the servlet response.


      Any idea?

      Thank you in advance,
      pepelara

      PS:
      I guess the problem is in any of the descriptors: web.xml or aplication.xml

        • 1. Re: Load index.jsp as welcome file
          jaikiran pai Master

          Post the contents of your web.xml.

          While posting the xml content or code or logs, remember to wrap it in a code block using the Code button in the message editor window and please hit the Preview button to make sure your post is correctly formatted

          • 2. Re: Load index.jsp as welcome file
            Jose Alvarez de Lara Novice

            This is my web.xml file,

            <?xml version="1.0" encoding="ISO-8859-1"?>
            <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
            <web-app>
             <servlet>
             <servlet-name>ServletEntrada</servlet-name>
             <servlet-class>es.deusto.servlet.ServletEntrada</servlet-class>
             </servlet>
            
             <servlet-mapping>
             <servlet-name>ServletEntrada</servlet-name>
             <url-pattern>/*</url-pattern>
             </servlet-mapping>
            
             <mime-mapping>
             <extension>doc</extension>
             <mime-type>application/msword</mime-type>
             </mime-mapping>
             <mime-mapping>
             <extension>xls</extension>
             <mime-type>application/vnd.ms-excel</mime-type>
             </mime-mapping>
             <mime-mapping>
             <extension>ppt</extension>
             <mime-type>application/vnd.ms-powerpoint</mime-type>
             </mime-mapping>
             <mime-mapping>
             <extension>pdf</extension>
             <mime-type>application/pdf</mime-type>
             </mime-mapping>
             <mime-mapping>
             <extension>zip</extension>
             <mime-type>application/zip</mime-type>
             </mime-mapping>
            
             <welcome-file-list>
             <welcome-file>index.jsp</welcome-file>
             </welcome-file-list>
            
            </web-app>
            


            And this is my application.xml file,

            <?xml version="1.0" encoding="UTF-8"?>
            <!DOCTYPE application PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN' 'http://java.sun.com/j2ee/dtds/application_1_2.dtd'>
            <application>
             <display-name>Entrada</display-name>
             <description>This is the implementaion of the EntradasUsuario application</description>
             <module>
             <ejb>entrada-ejb.jar</ejb>
             </module>
             <module>
             <web>
             <web-uri>entrada-web.war</web-uri>
             <context-root>/entrada</context-root>
             </web>
             </module>
            </application>


            • 3. Re: Load index.jsp as welcome file
              mark spencer Newbie

              Hello,
              not sure if I have understood clearly, but why do you have your
              servlet mapped as "/*" ?

              <servlet-mapping>
               <servlet-name>ServletEntrada</servlet-name>
               <url-pattern>/*</url-pattern>
               </servlet-mapping>
              


              I think it will intercept all requests this way.....
              shouldn't you rather define an endpoint "/myservlet" and recall it from the jsp action ?


              • 4. Re: Load index.jsp as welcome file
                Jose Alvarez de Lara Novice

                Thank you Francis,

                You have had a good idea.
                Now my application works ok.

                Thank you again,
                pepelara

                • 5. Re: Load index.jsp as welcome file
                  Jose Alvarez de Lara Novice

                  Hi,

                  Following with my application UserEntries I have took out the connection to my DB from the Entity EJB and I leave it alone in a package es.deusto.dbaccessor with my connection class DBConnection.class.

                  My problem is that when I create my ear, it seems as if the application does not find up this class. When I call this class, on the first line of code, the server return me a NullPointerException.

                  I think that I am not building right my ear because when I deploy it on JBoss 4.2.2 GA
                  appears on the console my ejb.jar, my servlet.war, but nothing about dbaccessor-client.jar

                  Thanking in advance,
                  pepelara