As most always, TMTOWTDI (Perl-speak for "there's more than one
way to do it"). In your deployment discriptor...
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
<web-app>
<servlet>
<servlet-name>
X
</servlet-name>
<servlet-class>
XServlet
</servlet-class>
</servlet>
<servlet>
<servlet-name>
Y
</servlet-name>
<servlet-class>
YServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>
X
</servlet-name>
<url-pattern>
/XServlet
</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>
X
</servlet-name>
<url-pattern>
/X
</url-pattern>
</servlet-mapping>
</web-app>
Using this as a template to expand possibilities for both X and Y
servlets, you can now use an href of http://your_server/X or
http://your_server/XServer or anything else (including html
extensions if you want to hide the fact you are using servlets).
Cheers!
Mark
----- Original Message -----
From: "Duane Morse" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 31, 2001 8:32 PM
Subject: URLs and servlet mapping
> I'm confused about the rules related to servlet mapping.
Suppose my Web app
> is called MyApp, and I make a servlet
> mapping to associate the URL "/MyApp/X" with servlet XServlet.
Suppose
> XServlet produces a page with a HREF to
> another servlet, YServlet. I know that mapping "/MyApp/Y" to
"YServlet"
> works, so "/MyApp/Y" would be a valid
> HREF. But must the HREF (and, correspondingly, the servlet
mapping), always
> start with the Web app name?
> If I wanted to make the HREF simply "Y", would the request make
it to MyApp
> at all? If so, would the URL have been
> transformed into "/MyApp/Y" so that the servlet mapping would
do the right
> thing?
>
> Duane Morse, Eldorado Computing Inc., Phoenix Arizona
>
>
_________________________________________________________________
__________
> 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
>
___________________________________________________________________________
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