Difference between version and version      View first change»»

Back to HowToUseAServletAsYourMainWebPage, or HowToUseAServletAsYourMainWebPage version history

At line 70 changed 1 line.
* As the path for <[welcome-file|web.xml.WelcomeFile]> is relative, a servlet can only be used as the main page of the application, and not a welcome file for every folder. This is because if the user attempts to access http://<domainName>/<appName>/someFolder, you must also have a <[url-pattern|web.xml.URLPattern]> mapping for /someFolder/servlet/MyServlet. Even if you map the servlet as *.foo, a <[welcome-file|web.xml.WelcomeFile]> of index.foo will not work (at least in Tomcat versions up to and including 5.5.23 and 6.0.13. If you want the servlet to work as a default for any folder, consider changing the [Default Servlet] instead.
* As the path for <[welcome-file|web.xml.WelcomeFile]> is relative (and cannot be absolute), a servlet can only be used as the main page of the application, and not a welcome file for every folder. This is the same for other index files such as index.htm, in that they cannot refer to a single index.htm file, but instead cause Tomcat to search the specified folder for a file called "index.htm". Even if you map the servlet as *.foo, a <[welcome-file|web.xml.WelcomeFile]> of index.foo will not work (at least in Tomcat versions up to and including 5.5.23 and 6.0.13). One workaround is to also specify a <[url-pattern|web.xml.URLPattern]> mapping for /someFolder/MyServlet (where /someFolder is the folder you want to use the servlet in, and /MyServlet is your <[url-pattern|web.xml.URLPattern]>). Another way to make the servlet work as a default for any folder is to change the [Default Servlet] instead.
\\
navigation
metawerx specific
search
Share
tools
help

referring pages

Share