File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes servlet problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlet problem" Watch "servlet problem" New topic

servlet problem

Simon Xu
Ranch Hand

Joined: Aug 16, 2000
Posts: 235
I installed Tomcat and Apache under win 95, set up the classpath as required. sample programs in dir \webappls\examples\servlets\ run OK. I compile my and put the class file in \examples\Web-inf\classes\, the .html in \examples\servlets\
The .html file as follows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- HTTPGETServlet.html -->
<TITLE>Servlet HTTP GET Example</TITLE>
<P>Click the button to have the servlet send an HTML document</P>
<INPUT TYPE = "submit" VALUE = "Get HTML document">
Please help,
Simon Xu
Ranch Hand

Joined: Aug 16, 2000
Posts: 235
sorry, i forgot to point out the problem.
the error given when i press the Button "Get HTTP document":
Not Found (404)
Original request: /examples/Web-inf/classes/HTTPGetServlet
Not found request: /examples/Web-inf/classes/HTTPGetServlet
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
Is not the correct way to address the servlet. In fact, web servers are forbidden to directly serve any file from the WEB-INF directory. Instead, the server applies various rules to the raw URL to determine exactly what needs to be done.
should do the trick. Take a look at the example servlets and JSP provided with Tomcat to see how they are addressed. Study the web.xml file in the webapps/examples/WEB-INF directory.

author of:
Simon Xu
Ranch Hand

Joined: Aug 16, 2000
Posts: 235
hi, Bill,
I got it worked. But how does the server know the location of the class file?
I agree. Here's the link:
subject: servlet problem
It's not a secret anymore!