Jason Novotny wrote:
> I would like to be able to access a servlet with the URL
> http://localhost:8080/demo
>
> However, it only works if I go to
> http://localhost:8080/demo/servlet/demo
>
> I have the following in server.xml and web.xml respectively:
>
> <Context path="/demo"
> docBase="webapps/demo"
> crossContext="true"
> debug="0"
> reloadable="true"
> trusted="false" >
> </Context>
>
> BTW, should I comment out or use the following in some way?
> <RequestInterceptor
> className="org.apache.tomcat.request.InvokerInterceptor"
> debug="0" prefix="/servlet/" />
>
> My web.xml in webapps/demo/WEB_INF/web.xml has the following:
>
> <servlet>
> <servlet-name>demo</servlet-name>
> <servlet-class>org.demo.DemoServlet</servlet-class>
> </servlet>
>
> <servlet-mapping>
> <servlet-name>demo</servlet-name>
> <url-pattern>/demo</url-pattern>
> </servlet-mapping>
>
> So I would like to be able to use <form action="/demo"> and have the
> servlet invoked.
>
> Thanks very much, Jason
>
> --
> Jason Novotny [EMAIL PROTECTED]
> Home: (510) 704-9917 Work: (510) 486-8662
> NERSC Distributed Computing http://www-didc.lbl.gov
> [...]
Hi :-) with jakarta-tomcat-4.0-b1(standalone, JDK1.3, winnt40),
I find:
* in webapps/myapp/WEB_INF/web.xml:
- if I define the following servlet definitions:
<servlet-name>sn_0</servlet-name>
<servlet-name>sn_1</servlet-name>
...
<servlet-name>sn_m</servlet-name>
- and I define the following servlet-mapping:
<servlet-mapping>
<servlet-name>sn_0</servlet-name>
<url-pattern>/up_0</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>sn_1</servlet-name>
<url-pattern>/up_1</url-pattern>
</servlet-mapping>
...
<servlet-mapping>
<servlet-name>sn_m</servlet-name>
<url-pattern>/up_m</url-pattern>
</servlet-mapping>
i.e., I map sn_j to up_j (0<=j<=m)
* then :
- if NOONE "from up_0 to up_m" = "/", we can use the
following to invoke MyServlet:
http://localhost:8080/myapp/servlet/MyServlet
and:
http://localhost:8080/myapp/up_0
...
http://localhost:8080/myapp/up_m
i.e., now we have m+1 "named" servlet definitions and
1 "default(non-named)" servlet definition.
- if ANYONE "from up_0 to up_m" = "/", now I find perhaps
it is what you need (i suppose up_i="/", 0<=i<=m):
% we still can use the following to invoke MyServlet:
http://localhost:8080/myapp/servlet/MyServlet
and:
http://localhost:8080/myapp/up_x (0<=x<=m, x ! = i)
http://localhost:8080/myapp/YYY
( YYY!=up_x, YYY can be anything :-) )
i.e., we can use:
http://localhost:8080/myapp
http://localhost:8080/myapp/
http://localhost:8080/myapp/hahahahaha //hahahahaha :-)
...
and thay ALL invoke the Same servlet defnition whose name
is "sn_i" .
Bo
Mar.02, 2001
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]