You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Stefan Woithe <st...@net-linx.com> on 2000/11/30 22:05:10 UTC

web app. mapping configuration

Hi all,

Using Tomcat 3.2final

In $TOMCAT_HOME/conf/server.xml:

        <Context path="/myapp" 
                 docBase="../myapp" 
                 crossContext="false"
                 debug="0" 
                 reloadable="false" 
                 trusted="false" > 
        </Context>

In myapp/WEB-INF/web.xml:

    <servlet>
        <servlet-name>
            MasterServlet
        </servlet-name>
        <servlet-class>
            com.hulla.devil.MasterServlet
        </servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>
            MasterServlet
        </servlet-name>
        <url-pattern>
            /
        </url-pattern>
    </servlet-mapping>

So I can call

    http://localhost:8080/myapp

an it works fine. Now, the servlet includes JSP which contain image tags. The images are localted in

    myapps/images

and the "src" attribute of the "img" tag reads like:

    src="images/myimage1.gif"

The browser asks correctly for

    http://localhost:8080/myapp/images/myimage1.gif

PROBLEM: The server doesn't deliver them. Instead it calls the MasterServlet. How to write web.xml or organize the myapp subdirectories to enable the pictures to be found? One thing is 'must be': The MasterServlet acts like an welcome page (so I never want to call something like

    http://localhost:8080/myapp/MasterServlet

)

Thank you indeed

Stefan