You haven't said anything about your Tomcat configuration. What version? Are you running it standalone or through Apache? Basically, it sounds like you need to create a <Context> in your server.xml which maps the root (/) to your servlet. In the default Tomcat config, look at how they map the context ROOT.
Jeff ----- Original Message ----- From: "Sean LeBlanc" <[EMAIL PROTECTED]> To: "'Tomcat Users List'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, March 22, 2002 12:31 PM Subject: RE: Servlet mapping question > > > > -----Original Message----- > > From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, March 21, 2002 11:25 AM > > To: [EMAIL PROTECTED] > > Subject: Servlet mapping question > > > > > > I want to have a servlet listen at the top level of my app > > for urls of this > > type: > > > > http://www.myserver.com/foo > > http://www.myserver.com/bar > > etc. > > > > Basically, anything NOT in a subdir, or ending in .jsp or > > .html. I want the > > "foo" and > > "bar" to be data driven, not something I have to put into the > > web.xml file > > and restart. > > > > So, if a user puts in a "bar2", and it's NOT found in the > > database as being > > valid, I will > > then have servlet redirect to the default home page. If it is > > valid, then I > > will execute some code, > > and then redirect to a page specified in database (by matching the url > > given). > > Does anyone know how I could do this? What I have tried so > > far is putting an > > url pattern like > > this in the web.xml: > > > > <servlet-mapping> > > <servlet-name>Listen</servlet-name> > > <url-pattern>/*</url-pattern> > > </servlet-mapping> > > > > and then have the servlet do a response.sendredirect() to the > > .jsp if it was > > not an URL of the type > > I describe above...this only creates an endless loop, though, > > because the > > servlet sees the > > redirect, too. > > > > I have tried something like <url-pattern>/*/$</url-pattern>, > > but that seemed > > to match nothing at all > > for me. > > > To add even more to this - I can't even get the pattern like this > to work: > > <url-pattern>/c*</url-pattern> > > anything typed doesn't seem to get recognized and used by the > servlet. Any ideas would be welcome. > > -- > 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]>