set the welcome file list element to the URL address you want to default to
Something like -

<welcome-file-list>
    <welcome-file>pages/main.jsp</welcome-file>
</welcome-file-list>

This will default a user going to your context to the file pages/main.jsp -
Tomcat (4.1) has a few default context attributes which are located in the
CATALINA_HOME/conf/web.xml which a context will default to if the welcome
file list element is not specified - they are as follows

  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>

HTH

S.

-----Original Message-----
From: Scott Eade [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 21, 2001 6:54 AM
To: [EMAIL PROTECTED]
Subject: servlet-mapping problem - tomcat 4.0.1


How do I default a user to my servlet without blocking access
to other directories?  Using a default mapping of "/" results in
failure to gain access to resources under my servlet directory.

I think I have a fairly standard set-up of tomcat 4.0.1 on win2k.

Within C:\jakarta-tomcat-4.0.1\webapps I have a directory
structure like this:

    myapp
            styles
                    global.css
            WEB_INF
                    web.xml
                    lib
                            [jar files]

web.xml defines a servlet whose output includes a reference to 
http://mysite.com/myapp/styles/global.css

If I set my servlet mapping up like this:
    <servlet-mapping>
        <servlet-name>myapp</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
then the stylesheet cannot be loaded when the user surfs to
http://mysite.com/myapp/

Alternatively if I set up my mapping like this:
    <servlet-mapping>
        <servlet-name>myapp</servlet-name>
        <url-pattern>/foo/*</url-pattern>
    </servlet-mapping>
then the stylesheet can be located, but the user must surf to
http://mysite.com/myapp/foo/

How can I configure tomcat or structure my directories so that 
a user can surf to http://mysite.com/myapp/ and also successfully
access the stylesheet?

Note that the above is a contrived example.  The real servlet
includes many other resources in the myapp directory to which
the servlet refers.

Any advice would be most welcome.

Thanks,

Scott



--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to