You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by cbarnes <cb...@tarantella.com> on 2002/06/19 14:32:50 UTC

Servlet mappings

I have written the servlet com.mycompany.MyServlet.

I then added the following lines to my web.xml file:

<servlet>
    <servlet-name>myservlet</servlet-name>
    <servlet-class>com.mycompany.MyServlet</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>myservlet</servlet-name>
    <url-pattern>/myservlet</url-pattern>
</servlet-mapping>

I thought that I would then be able to access this servlet using the URL:
http://host:port/applicationname/myservlet
However, I get a 404 not found error. Am I right in thinking that I should
be able to access the servlet in this way?
Can anyone suggest where I have gone wrong?

Thanks,
Catharine


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Servlet mappings

Posted by Ravishankar S <ra...@ionidea.com>.
Hi Catharine,

in Tomcat 3.x the <servlet-mapping> declarations can come immdtly after the
<servlet> directive..however with 4.x u have to declare all the servlets at
the top and all the mappings below the servlet declrns...

also if u notice the DTD version in 3.x is 2.2 whereas in 4.x is 2.3..maybe
it's because of this...

HTH

regards,
ravi


----- Original Message -----
From: "cbarnes" <cb...@tarantella.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Wednesday, June 19, 2002 6:05 PM
Subject: Re: Servlet mappings


> I forgot to say - I am using Tomcat 4.
>
> Catharine
>
> > I have written the servlet com.mycompany.MyServlet.
> >
> > I then added the following lines to my web.xml file:
> >
> > <servlet>
> >     <servlet-name>myservlet</servlet-name>
> >     <servlet-class>com.mycompany.MyServlet</servlet-class>
> > </servlet>
> >
> > <servlet-mapping>
> >     <servlet-name>myservlet</servlet-name>
> >     <url-pattern>/myservlet</url-pattern>
> > </servlet-mapping>
> >
> > I thought that I would then be able to access this servlet using the
URL:
> > http://host:port/applicationname/myservlet
> > However, I get a 404 not found error. Am I right in thinking that I
should
> > be able to access the servlet in this way?
> > Can anyone suggest where I have gone wrong?
> >
> > Thanks,
> > Catharine
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
> >
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Servlet mappings

Posted by cbarnes <cb...@tarantella.com>.
I forgot to say - I am using Tomcat 4.

Catharine

> I have written the servlet com.mycompany.MyServlet.
>
> I then added the following lines to my web.xml file:
>
> <servlet>
>     <servlet-name>myservlet</servlet-name>
>     <servlet-class>com.mycompany.MyServlet</servlet-class>
> </servlet>
>
> <servlet-mapping>
>     <servlet-name>myservlet</servlet-name>
>     <url-pattern>/myservlet</url-pattern>
> </servlet-mapping>
>
> I thought that I would then be able to access this servlet using the URL:
> http://host:port/applicationname/myservlet
> However, I get a 404 not found error. Am I right in thinking that I should
> be able to access the servlet in this way?
> Can anyone suggest where I have gone wrong?
>
> Thanks,
> Catharine
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>