On 27/01/2013 16:25, Varuna Seneviratna wrote: > I extracted tomcat-6.0.36 zip file to c:\tomcat, now root of my tomcat > installation is c:\tomcat. I have set the CLASSPATH to > > ".;C:\tomcat\lib\servlet-api.jar;C:\Program Files\Java\jdk1.7.0_10"
Don't do that. Tomcat configures the classpath for itself. > Tomcat-6.0.36 is now running and the Home page is displayed > > I created the below Servlet > <SERVLET> > import java.io.*; > import javax.servlet.*; > import javax.servlet.http.*; > > public class HelloWorld extends HttpServlet { > public void doGet(HttpServletRequest req, HttpServletResponse res) > throws ServletException, IOException { > > res.setContentType("text/html"); > PrintWriter out = res.getWriter(); > > > out.println("<HTML>"); > out.println("<HEAD><TITLE>Hello World</TITLE></HEAD>"); > out.println("BODY") > out.println("<BIG>Hello World</BIG>"); > out.println("</BODY></HTML>"); > > > } > } > > </SERVLET> > > The above Servlet was successfully compiled and the resulting .class > file was placed in the directory /webapps/ROOT/WEB-INF/classes > The classes directory was not created when the tomcat zip file was > extraxted so I created it my self.Inside WEB-INF/ directory there is a > web.xml file and I didn't do anything with it. You need to specify the Servlet in web.xml. That would be why it doesn't work, read the Servlet Specification for more information and follow the guide here: http://tomcat.apache.org/tomcat-6.0-doc/appdev/index.html Tip: don't modify the existing Tomcat applications, remove/backup the existing ones and replace them with the ones you create. p > When I tried to access the Servlet HelloWorld through the url > http://localhost:8080/servlet/HelloWorld the response is > <RESPONSE> > HTTP Status 404 - /servlet/HelloWorld > > type Status report > > message /servlet/HelloWorld > > description The requested resource is not available. > Apache Tomcat/6.0.36 > </RESPONSE> > > trying with the url http://localhost:8080/servlets/servlet/HelloWorld > resulted in the same response as above > > What must be done to get the Servlets deployed? > > Thanks > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > -- [key:62590808] --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org