> From: Hracek, Petr [mailto:petr.hra...@siemens-enterprise.com] > Subject: RE: Beginner with apache > > I am trying to develop a new servlet:
You still seem to be confusing the concepts of webapp and servlet. A servlet is a single Java class that extends the HttpServlet class, providing concrete methods for various HTTP operations. A webapp is a collection of servlets and other resources; only the most trivial webapp would consist of a single servlet. Consequently, any servlet you're writing must be within the context of a webapp. > /opt/secm/servlet directory has WEB-INF structure with class file and > web.xml file. > What rights has to have direcotry servlet and all subdirectories. The userid Tomcat is running with must have read access to this directory and subdirectories. > In the web.xml file is: > <?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>SecMServlet</servlet-name> > <servlet-class>SecMServlet</servlet-class> > </servlet> It's good practice (but not absolutely required for servlets) to use a package for all Java classes. > <servlet-mapping> > <servlet-name>SecMServlet</servlet-name> > <url-pattern>/SecM/servlet/SecMServlet</url-pattern> > </servlet-mapping> > </web-app> The above indicates you will access your servlet via the URL: http://[host][:port]/SecMServlet/SecM/servlet/SecMServlet Seems a bit verbose, but if that's what you want... > In /etc/tomcat55/Catalina/localhost/SecMServlet.xml is defined: > <Context docBase="/opt/secm/servlet" > crossContext="false" debug="0" reloadable="false" > > </Context> The <Context> element looks good; note that the name of the .xml file becomes part of the URL. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org