You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Milan Tomic <mi...@setcce.org> on 2005/11/22 18:18:26 UTC

Servlets (total beginner)

 

I have compiled my first servlet and copied it into
apache-tomcat-5.5.12\webapps\servlets-examples\WEB-INF\classes but when I
navigate my browser to http://localhost:8080/servlets-examples/DemoServlet
or http://localhost:8080/servlets-examples/servlet/DemoServlet I got an HTTP
404 error message. Other servlets from Tomcat examples (same folder) works
just fine. What am I doing wrong? Do I have to edit web.xml in order to
inform Tomcat that I have deployed new servlet? While testing JSPs I didn't
had to do this for new JSP page. Btw, is there a good tutorial (or tool)
about configuring web.xml file?


Re: Servlets (total beginner)

Posted by David Rickard <Da...@techbooks.com>.
Yes, you have to edit \webapps\servlets-examples\WEB-INF\web.xml to include 
your servlet.

All JSPs (at least, all JSPs ending in .jsp or .jspx) are mapped to the 
JspServlet in tomcat\conf\web.xml--which is why you can add JSPs without 
having to update Tomcat or webapp configuration; unless you uncomment the 
invoker servlet definition in tomcat\conf\web.xml (which creates a security 
hole--see the Tomcat documentation), you have to add the <servlet> and 
<servlet-mapping> values to the app web.xml (and reload the app) before 
Tomcat can find it.

Remember, if your servlet is part of a package, you have to use the fully 
qualified class name in web.xml (ala com.myapp.mypackage.MyServlet) and put 
the class file in the package-path directory 
(WEB-INF/classes/com/myapp/mypackage/MyServlet.class).

At 09:18 AM 11/22/2005, you wrote:
>
>
>I have compiled my first servlet and copied it into
>apache-tomcat-5.5.12\webapps\servlets-examples\WEB-INF\classes but when I
>navigate my browser to http://localhost:8080/servlets-examples/DemoServlet
>or http://localhost:8080/servlets-examples/servlet/DemoServlet I got an HTTP
>404 error message. Other servlets from Tomcat examples (same folder) works
>just fine. What am I doing wrong? Do I have to edit web.xml in order to
>inform Tomcat that I have deployed new servlet? While testing JSPs I didn't
>had to do this for new JSP page. Btw, is there a good tutorial (or tool)
>about configuring web.xml file?


--

David Rickard
Software Engineer

TechBooks/GTS
Your Single Source Solution!
Los Angeles CA * York, PA * Boston,MA * New Delhi, India
Visit us on the World Wide Web 
<http://www.techbooks.com>http://www.techbooks.com

david.rickard@techbooks.com
5650 Jillson St., Los Angeles, CA 90040
(323) 888-8889 x331
(323) 888-1849 (Fax)


Re: Servlets (total beginner)

Posted by Mark <el...@gmail.com>.
Check out the Web Tools Platform, as part of the Eclipse project.  It does a
great job of getting a new servlet developer up and running.

On 11/22/05, Suresh Nair <su...@sph.com.sg> wrote:
>
> You must have send this to me by mistake.
>
> Please delete me from your message list.
>
> Thank you.
>
>
> SURESH NAIR
> (o) Suresh_Nair@sph.com.sg
> (h) singnair@yahoo.com.sg
> (h) singnair@gmail.com
> [image: Inactive hide details for "Milan Tomic" <mi...@setcce.org>]"Milan
> Tomic" <mi...@setcce.org>
>
>
>
>     *"Milan Tomic" <mi...@setcce.org>*
>
>             23/11/2005 01:18 AM Please respond to
>             "Tomcat Users List" <us...@tomcat.apache.org>
>
>
> To
>
> "'Tomcat Users List'" <us...@tomcat.apache.org>
> cc
>
>
> Subject
>
> Servlets (total beginner)
>
>
>
> I have compiled my first servlet and copied it into
> apache-tomcat-5.5.12\webapps\servlets-examples\WEB-INF\classes but when I
> navigate my browser to http://localhost:8080/servlets-examples/DemoServlet
> or http://localhost:8080/servlets-examples/servlet/DemoServlet I got an
> HTTP
> 404 error message. Other servlets from Tomcat examples (same folder) works
> just fine. What am I doing wrong? Do I have to edit web.xml in order to
> inform Tomcat that I have deployed new servlet? While testing JSPs I
> didn't
> had to do this for new JSP page. Btw, is there a good tutorial (or tool)
> about configuring web.xml file?
>
>
>
>
> NOTE: Privileged/Confidential Information may be contained in this
> message. If you are not the addressee indicated in this message (or
> responsible for delivery of the message to such person), you may not copy or
> deliver this message to anyone. In such case, you should destroy this
> message and kindly notify the sender by reply email. All opinions,
> conclusions and other information expressed in this message not of an
> official nature shall not be deemed as given or endorsed by Singapore Press
> Holdings Ltd or any of its subsidiaries unless otherwise indicated by an
> authorised representative independent of this message.
> Singapore Press Holdings Ltd
> Co. Regn No. 198402868E
>
>

Re: Servlets (total beginner)

Posted by Suresh Nair <su...@sph.com.sg>.
You must have send this to me by mistake.

Please delete me from your message list.

Thank you.


SURESH NAIR
(o)  Suresh_Nair@sph.com.sg
(h)  singnair@yahoo.com.sg
(h)  singnair@gmail.com


                                                                           
             "Milan Tomic"                                                 
             <milan@setcce.org                                             
             >                                                          To 
                                       "'Tomcat Users List'"               
             23/11/2005 01:18          <us...@tomcat.apache.org>           
             AM                                                         cc 
                                                                           
                                                                   Subject 
             Please respond to         Servlets (total beginner)           
               "Tomcat Users                                               
                   List"                                                   
             <users@tomcat.apa                                             
                 che.org>                                                  
                                                                           
                                                                           






I have compiled my first servlet and copied it into
apache-tomcat-5.5.12\webapps\servlets-examples\WEB-INF\classes but when I
navigate my browser to http://localhost:8080/servlets-examples/DemoServlet
or http://localhost:8080/servlets-examples/servlet/DemoServlet I got an
HTTP
404 error message. Other servlets from Tomcat examples (same folder) works
just fine. What am I doing wrong? Do I have to edit web.xml in order to
inform Tomcat that I have deployed new servlet? While testing JSPs I didn't
had to do this for new JSP page. Btw, is there a good tutorial (or tool)
about configuring web.xml file?




NOTE: Privileged/Confidential Information may be contained in this message.
If you are not the addressee indicated in this message (or responsible for
delivery of the message to such person), you may not copy or deliver this
message to anyone. In such case, you should destroy this message and kindly
notify the sender by reply email. All opinions, conclusions and other
information expressed in this message not of an official nature shall not
be deemed as given or endorsed by Singapore Press Holdings Ltd or any of
its subsidiaries unless otherwise indicated by an authorised representative
independent of this message.
Singapore Press Holdings Ltd
Co. Regn No. 198402868E