0
votes

I have jdk1.5.0_04 and tomcat server 1.0.16 installed on my computer. on my computer servlet is compiling properly on command prompt but during servlet execution on browser with following url: http://localhost:8080/webdir/servlet/helloworld. it giving error like : HTTP Status 404 - /servlet/webdir/helloworld

type Status report

message /servlet/webdir/helloworld

description The requested resource (/servlet/webdir/helloworld) is not available. Apache Tomcat/6.0.16

1

1 Answers

0
votes

Could you please double check your deployment descriptor (web.xml)? It should looks something like this:

    <web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

    <servlet>
        <servlet-name>ServletExample</servlet-name>
        <servlet-class>com.sarath.kumar.sivan.ServletExample</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>ServletExample</servlet-name>
        <url-pattern>/ServletExample</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
        <welcome-file> /pages/form.html </welcome-file>
    </welcome-file-list>
</web-app>

And your .html page should have something like this:

<form method="POST" action="ServletExample">