Didn't we say the same thing? I said: "Shouldn't I have gotten an exact match on my web app's default servlet, instead of it defaulting to Tomcat's default servlet?"
You said: "But what should happen is that Tomcat uses your servlet 'myServlet' instead of it's own default servlet." Those two statements are equivalent in my mind. If so, it sounds like we're both in agreement on this. Maybe a Tomcat'er will see this over the weekend and comment. On side note, looking at the Tomcat source, there's an explicit check to ignore this case in the "exact match" code. I'm confused. Jay > -----Original Message----- > From: Nic Ferrier [mailto:[EMAIL PROTECTED]] > Sent: Friday, April 26, 2002 5:19 PM > To: [EMAIL PROTECTED] > Subject: Re: Servlet mapping > > > Jay Burgess <[EMAIL PROTECTED]> writes: > > > With regards to mappings, Section 11.2 of the JSDK 2.3 spec says: > > A string containing only the '/' character indicates the "default" > > servlet of the application. In this case the servlet path is the > > request URI minus the context path and the path info is null. > > > > To make my servlet the default servlet of my web app, I put > the following > > into my web app's WEB.XML file: > > > > <servlet-mapping> > > <servlet-name>myServlet</servlet-name> > > <url-pattern>/</url-pattern> > > </servlet-mapping> > > > > I thought, then, that I could call my servlet from within a > JSP with the > > following, but it doesn't seem to work: > > > > <jsp:include page="/" flush="true"> > > <jsp:param name="someParam" value="someValue" /> > > </jsp:include> > > > > When calling the JSP with "http://myMachine/myApp/myJSP.jsp", the JSP > loads, but the <jsp:include> doesn't resolve correctly. Checking the debug > log (Tomcat 4.0.3), I see the following: > > Mapping contextPath='/myApp' with requestURI='/myApp/' and relativeURI='/' > Decoded relativeURI='/' > Trying exact match > Trying prefix match > Trying extension match > Trying default match > Mapped to servlet 'default' with servlet path '/' and path info 'null' > and update=true > > Shouldn't I have gotten an exact match on my web app's default servlet, > instead of it defaulting to Tomcat's default servlet? No. It's not an exact match because you can't do an exact match on the root because the root is used to map the default servlet. But what should happen is that Tomcat uses your servlet "myServlet" instead of it's own default servlet. I've had problems with Tomcat before in this area, it's really quite weak at things like this. You should send the Tomcat developers a bug report. Nic Ferrier ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
