Wrox Home  
Search P2P Archive for: Go

  Return to Index  

servlets thread: Re: I can't even to load servlet


Message #1 by gbilios@h... on Fri, 6 Sep 2002 17:07:53
7th of September, 2002

In Tomcat's root directory, store all your servlets in the 'classes' 
folder.  Tomcat needs to know where your servlets are, otherwise you will 
get an error.  

By default, the 'classes' folder is where you should store all your 
servlets.  

 gbilios


> i have download jakarta-tomcat-4.0.1 package and install it on win2000.
> After installation, i start tomcat engine.
> 
> it can successfully load http://localhost:8080/index.html.
> 
> But when i use a html to load a servlet, it always report HTTP Status 
> 404,The requested resource (/servlet/Hello) is not available.
> 
> Can anybody Help??? I have stuck for a whole day!!!Help pls....!
> 
> 
> 
> My configuration:
> i made a folder under ROOT called 'testing' with a file called 
index.html.
> 
> <html>
> <body>
> <form  method="POST" ACTION="/servlet/Hello" >
> <input type="submit" value="submit"></p>
> </form>
> </body>
> </html>
> 
> another Hello.class file under \ROOT\testing\WEB-INF\classes
> Hello.java code as belowed.
> 
> import java.io.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
> 
> public class Hello extends HttpServlet
> {
>  public void doPost(HttpServletRequest req, HttpServletResponse res)
>  throws ServletException, IOException
>  {
>  	res.setContentType("text/html");
>  	PrintWriter out = res.getWriter();
>  	out.println("<HTML>");
>  	out.println("servlet here");
>  	out.println("</html>");
>  }
> }
> 
> 

  Return to Index