tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Partha Bhattacharjee <Part...@trisoftdesign.com>
Subject How to run servlets???
Date Thu, 28 Sep 2000 04:51:33 GMT
Hello, 

I have just installed tomcat in my computer. I have been able to run jsp
pages but  not servlets. Here are the steps that I followed to run servlets.

Created a dir 'myjsp' in 'webapps' directory.

Written the following xml element in the 'server.xml'

<Context 
	path="/myjsp"
	docBase="webapps/myjsp"
	debug="0"
 	reloadable="true">
</Context>
Created a 'WEB_INF' dir in 'myjsp'.
Created a 'classes' dir in 'WEB_INF'.

In 'WEB_INF' I placed the following 'web.xml' file.

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">

<web-app>
    <servlet>
        <servlet-name>
            firstServlet
        </servlet-name>
        <servlet-class>
            firstServlet
        </servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>
            firstServlet
        </servlet-name>
        <url-pattern>
            /firstServlet
        </url-pattern>
    </servlet-mapping>

</web-app>

Now I have put 'firstServlet.class' in the 'classes' directory. 

Still I can not get the servlets on the web browser. However the .jsp files
put in the  'myjsp' are working fine.

Please help.
Thanks in advance. 
partha.





Mime
View raw message