This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, I created a servlet which included in a package com.abc.web.Checkin and the class is CheckinServlet. I created a dir "abc" under /var/tomcat4/webapps/. So, /var/tomcat4/webapps/abc/index.jsp will be shown when I browsed it at http://localhost:8080/abc/index.jsp. In the index.jsp, I have a form action=/abc/servlet/com.abc.web.Checkin.CheckinServlet And the CheckinServlet.class was placed in /var/tomcat4/webapps/abc/WEB-INF/classes/com/abc/web/Checkin/CheckinServlet.class. However, the browser returns that there is no such page: http://localhost:8080/abc/servlet/com.abc.web.Checkin.CheckinServlet Why and how can I fix this problem? Where should I place the servlet and be defined in form action? Thanks Andrew
You would be better off creating an entry for the servlet in the web.xml for your "abc" web application. That way you could address it with a short URL. See the Tomcat examples/WEB-INF/web.xml for examples with explanation. Download the servlet API from java.sun.com for the full details on what goes in a web.xml. Bill
Joined: Nov 12, 2001
Dear Sir, In fact, I have a web.xml file which located at /webapps/abc/WEB-INF/web.xml. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <servlet> <servlet-name>CheckinServlet</servlet-name> <servlet-class>com.abc.web.Checkin.CheckinServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>CheckinServlet</servlet-name> <url-pattern>/CheckinServlet</url-pattern> </servlet-mapping> </web-app> But, it still did not work. Any idea? Regards Andrew