Hi, This is my first program, i have problems in viewing the output. I am able to run tomcat http://localhost:8080 works fine. But,When i try to see my output http://localhost:8080/chapter01/servlet/HelloWorldServlet , it doesnt work. I copied the class file and placed in E:\jakarta-tomcat-4.0.1\webapps\chapter01\WEB-INF\classes and created web.xml in the directory E:\jakarta-tomcat-4.0.1\webappas\chapter01\WEB-INF my classpath is E:\jdk131\bin;.;E:\jakarta-tomcat-4.0.1\common\lib\servlet.jar CATALINA_HOME: E:\jakarta-tomcat-4.0.1 JAVA_HOME: E:\jdk131 Please tell me if i am missing something
I placed my classes in the path webapps/examples/WEB-INF/classes, and that worked. I guess this is the default path in tomcat. I did not create my own directory in place of "examples". But I too want to know what all changes have to be done in case I want to keep my servlet classes in some user-specific path, like webapps/chapter1/WEB-INF/classes. Do I have to modify the server.xml file or some other file, and if so, what all changed are required. Any help will be appreciated. Thanks, Sudd
Ok Guys, here is what u need to do. Create a copy of the examples directory in the webapps directory. Rename it to chapter01. Now remove all the unnecessary files and directories in chapter01 and put your class files in the classes dir. clean up the web.xml and add the tags u needed. Thats it. For more info check this thread
Chitra: Assuming everything is installed fine, there are couple of things you can do for HelloWorldServlet under chapter01 webapp to work. 1. You can enable the default "invoker" servlet to kick-in ( which is what you tried to use ). or 2. Create a servlet-mapping element in your chapter01\WEB-INF\web.xml file. For the first option, uncomment the servlet-mapping element for the "invoker" servlet, in the file $CATALINA_HOME\conf\web.xml. This is commented out, by default in tomcat 4.1.12, which i assume is the case with your version, too. Then the URL you used should work. For the second option, add the following servlet-mapping to your chapter01\WEB-INF\web.xml file.
Then your HelloWorldServlet can be access via HelloWorldServlet Change the url-pattern and the port #, as you wish. Hope this helps
Joined: Oct 23, 2002
Don's suggestion worked. Thanks Don. It was not as complicated as I imagined. Thanks, Sudd