public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.setContentType("text/html"); PrintWriter out = resp.getWriter();
out.println("<HTML>"); out.println("<HEAD><TITLE>Have you seen this before?</TITLE></HEAD>"); out.println("<BODY><H1>Hello, World!</H1><H6>Again.</H6></BODY></HTML>"); } }
placed in "tomcat5.0\webapps\root\web-inf\classes" and complied there itself
HTTP Status 404 - /servlet/HelloServlet type Status report message /servlet/HelloServlet description The requested resource (/servlet/HelloServlet) is not available. Apache Tomcat/5.0.28
nore i restarted my tomcat server and also verified
From the looks of the URL that you're using to try to access your servlet, I'd guess that you're using a slightly out of date book or tutorial.
In the past, you could call servlets this way via the InvokerServlet. That has been commented out of the Tomcat config scripts for the last few years. Your servlet will need to be mapped in your deployment descriptore (web.xml).
You are trying to use the InvokerServlet, which is why you can call the servlet without configuring it in web.xml, but the InvokerServlet is not enabled by default, you would have to configure Tomcat to allow this first.
Much better to configure the servlet correctly and not use the Ivoker, it is not a good thing to use.
using web.xml is nice idea and we have to do like that for a good practice.
But just i want to know what is happening whats the mistake i done is this o done anything wrong.
The mistake is that you're trying to use a feature that is no longer present. The explicit mapping of servlets is no longer just a best practice. It's "how servlets are deployed".
I am very much thankful to you for your site which had examples. i am very pleased to see this site.
and the link "http://faq.javaranch.com/view?InvokerServlet" is simply excellent Ben, thanks for this.
Another thing just i want to notify that i am using
CoreServlets and JavaServerPages Volume 1:Coretechnologies Second Edition only
in this book only i saw that urls any way thanks for notifying me..But i am suffereing with another problem as this book is not updated in future i may get any errors like this...pls can u guide me
Sunesh, when that version of core servlets book was written the examples used a previous version of tomcat. You eithr need to access the servlets as the previous posted have mentioned, get a more updated book, or just download the version of tomcat that book recommended, which I believe is version 3.1 or so.