Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to configure Tomcat 6.0.36 in Windows 7 to use servlets
    primarykey
    data
    text
    <p>I extracted tomcat-6.0.36 zip file to c:\tomcat, now root of my Tomcat installation is <em>C:\tomcat</em>. I have set the CLASSPATH to</p> <p>".;C:\tomcat\lib\servlet-api.jar;C:\Program Files\Java\jdk1.7.0_10"</p> <p>Tomcat-6.0.36 is now running and the Home page is displayed</p> <p>I created the below Servlet</p> <pre><code>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("&lt;HTML&gt;"); out.println("&lt;HEAD&gt;&lt;TITLE&gt;Hello World&lt;/TITLE&gt;&lt;/HEAD&gt;"); out.println("BODY"); out.println("&lt;BIG&gt;Hello World&lt;/BIG&gt;"); out.println("&lt;/BODY&gt;&lt;/HTML&gt;"); } } </code></pre> <p>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.</p> <p>When I tried to access the Servlet HelloWorld through the URL /servlet/HelloWorld the response is</p> <blockquote> <p> HTTP Status 404 - /servlet/HelloWorld</p> <p>type Status report</p> <p>message /servlet/HelloWorld</p> <p>description The requested resource is not available. Apache Tomcat/6.0.36 </p> </blockquote> <p>Trying with the URL <code>/servlets/servlet/HelloWorld</code> resulted in the same response as above</p> <p>What must be done to get the Servlets deployed? Please tell me how to modify <em>web.xml</em> file in the WEB-INF directory.I have referred many questions posted even on Stackoverflow, but found no solution.</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload