"neal" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Nope. Doesnt work ... I just tried it. Two problems: > > 1. When mapping the servlet to "/" EVERYTHING requested will return that > default page .. even sub pages, graphics etc. Apparently "/" does not map to > the default page at the root level, rather anything and everything requested > from that domain!
The servlet-mapping "/" is special. It specifies the servlet that gets called when no other mapping matches. By default, it is mapped to Catalina's DefaultServlet, but if you specify another servlet in your web.xml file, it will go to that one instead. What you want to do is possible in Tomcat 3.3.2-dev (with non-default options set), and I'm guessing will eventually be possible in Tomcat 5.x (since the hard part is required by the 2.4 Servlet-Spec). However, to get it into the 4.1.x code-base, you'll probably have to push the issue yourself with patches. Since Tomcat's behavior falls within the 2.3 Servlet-Spec, it can't really be considered a bug. > > 2. <base> apparently isn't supported by Netscape 4.7 so even if the above > was working, this still would not apparently be an option for some of the > older but still supported browsers. > > :( > > Any other thoughts? I'm not to keen on this 'feature'. > > Thanks. > Neal > > -----Original Message----- > From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] > Sent: Monday, November 18, 2002 4:30 PM > To: Tomcat Users List > Subject: RE: auto-redirect to default page - undesired > > > > > On Mon, 18 Nov 2002, neal wrote: > > > Date: Mon, 18 Nov 2002 16:12:29 -0800 > > From: neal <[EMAIL PROTECTED]> > > Reply-To: Tomcat Users List <[EMAIL PROTECTED]> > > To: Tomcat Users List <[EMAIL PROTECTED]> > > Subject: RE: auto-redirect to default page - undesired > > > > Well, cool idea but there's still a problem: > > > > I mean...The requestDispatcher *does* redirect to the right page *BUT* all > > my relative links are broken. So, I tried mapping the forward servlet to > > the path "/test" instead of just "/" and sure enough *that* url worked ... > > relative paths just fine. So even though mapping to "/" did get the page > to > > call correctly, nothing in that page resolved correctly. Somehow its > > context was off I guess. Do you know of some alternative syntax to "/" > that > > could be specified to indicate the root of the domain? I tried everything > I > > could think of and nothing else worked (e.g. "", "/*", "*", "*/", etc). > > > > That's not a bug ... that's a feature :-). > > The reason relative references are often broken by > RequestDispatcher.forward() comes from the fact that the reference is > resolved by your *browser* (not by the server), against the request URI to > which the request was originally submitted. The browser has no idea that > the forward happened, so if it points into a different subdirectory of > your webapp, it will typically fail. > > One workaround for this is to include an HTML <base> element nested in > your <head> element. This will allow you to specify the absolute URL > against which relative URLs are resolved -- you would typically set it to > the absolute URL of the page file itself. That way, relative links will > work when the page is accessed directly and when it is accessed via a > forward. > > Implementing this idea is pretty tedious if you don't have a tag library > that takes care of it for you, like the <html:base/> tag in Struts. > > > Thanks. > > Neal > > Craig > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
