Admittedly, as another poster noted, a tour through the docs
(specifically the Servlet spec) would help you tremendously in figuring
this out yourself. To answer your question -- your url should be
http://localhost:8080/myApp/TestingServlet. For your own sanity, read
the spec though. It provides some really good info.
Here's a url to the spec version you have defined in your web.xml:
http://www.jcp.org/aboutJava/communityprocess/final/jsr053/
--David
Marco Mastrocinque wrote:
Hi All,
I'm new to Tomcat and Servlets, I'm having a problem with one of my
first Servlets:
This is my program:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class TestingServlet extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println("<HTML>");
out.println("<HEAD>");
out.println("<TITLE>Servlet Testing</TITLE>");
out.println("</HEAD>");
out.println("<BODY>");
out.println("Welcome to the Servlet Testing Center");
out.println("</BODY>");
out.println("</HTML>");
}
}
This is my web.xml file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<wep-app>
<servlet>
<servlet-name>Testing</servlet-name>
<servlet-class>TestingServlet</servlet-class>
</servlet>
</wep-app>
I'm using Tomcat version 5.0.28.
I create the Directory structure under Tomcat, underneath the webapps
subdirectory:
myApp
|
WEB-INF
|
classes
I compile the file TestingServlet.java using
javac -classpath C:\tomcat\common\lib\servlet-api.jar TestingServlet.jar
Place the file TestingServelt.jar in the classes subdirectory.
Place the file web.xml file in the WEB-INF subdirectory.
I start Tomcat. The manager application says it there, and it seems to be
okay.
I type in the address bar of IE the following
http://locahost:8080/myApp/servlet/TestingServlet
I get the following message, from Tomcat
The requested resource (/myApp/servlet/TestingServlet) is not available.
I know it should be pretty simple, but sometimes the simplest things are the
hardest to correct!
Any suggestions most appreciated.
Thanks Marco Mastrocinque
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]