2 Replies Latest reply on Jul 1, 2004 8:30 AM by Jim Stoll

    how to map two servlets ?

    Jim Stoll Newbie

      i have the folllowing in my web.xml

      <web-app>
       <display-name>jlwi</display-name>
       <description>no description</description>
      
      <servlet>
       <servlet-name>HelloServlet</servlet-name>
       <servlet-class>mil.jlwi.utils.HelloServlet</servlet-class>
      </servlet>
      <servlet-mapping>
       <servlet-name>HelloServlet</servlet-name>
       <url-pattern>/HelloServlet</url-pattern>
      </servlet-mapping>
      <servlet>
       <servlet-name>BannerAction</servlet-name>
       <servlet-class>mil.jlwi.utils.BannerAction</servlet-class>
      </servlet>
      <servlet-mapping>
       <servlet-name>BannerAction</servlet-name>
       <url-pattern>/BannerAction</url-pattern>
      </servlet-mapping>
      </web-app>
      



      and i am getting the following


      org.xml.sax.SAXParseException: The content of element type "web-app" must match
      "(icon?,display-name?,description?,distributable?,context-param*,filter*,filter-
      mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welco
      me-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-const
      raint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)".



      what have i not done right or better yet where is the dtd for web.xml

      Thanks in advane for your time

      jim

        • 1. Re: how to map two servlets ?
          Mathew Blackberry Newbie

          try putting your two servlet tags together.
          ie.

          <web-app>
           <display-name>jlwi</display-name>
           <description>no description</description>
          
          <servlet>
           <servlet-name>HelloServlet</servlet-name>
           <servlet-class>mil.jlwi.utils.HelloServlet</servlet-class>
          </servlet>
          <servlet>
           <servlet-name>BannerAction</servlet-name>
           <servlet-class>mil.jlwi.utils.BannerAction</servlet-class>
          </servlet>
          <servlet-mapping>
           <servlet-name>HelloServlet</servlet-name>
           <url-pattern>/HelloServlet</url-pattern>
          </servlet-mapping>
          <servlet-mapping>
           <servlet-name>BannerAction</servlet-name>
           <url-pattern>/BannerAction</url-pattern>
          </servlet-mapping>
          </web-app>
          


          hope this helps
          Mat

          • 2. Re: how to map two servlets ?
            Jim Stoll Newbie

            blackers


            It worked !

            Thanks

            Jim