You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Eitan Ben Noach <Ei...@proficiency.com> on 2001/06/30 01:38:38 UTC

RE: Using the element on web.xml to define short name f or a servlet in a package

Thanks Michael,

The servlet-mapping element did solve the problem, although I've to put a
short web.xml containing this mapping in the webapps/admin/web-inf/
directory. Adding this mapping to the main web.xml under the tomcat root
directory, didn't help.
Is it suppose to behave like this?

Now, I'm trying to do the same but now with Apache as the HTTP server ( till
now I was running tomcat standalone ). It seems that there is need for
another change, since that in the new combination
http://localhost/admin/controller does not work - maybe apache does not
delegates the name 'controller' to Tomcat.

What should I do?

Thanks,
Eitan


> -----Original Message-----
> From: Michael Wentzel [mailto:Michael.Wentzel@aswethink.com]
> Sent: Friday, June 29, 2001 10:48 PM
> To: 'tomcat-user@jakarta.apache.org'
> Subject: RE: Using the <servlet> element on web.xml to define 
> short name
> f or a servlet in a package
> 
> 
> > I put a package called FTPExplorer.jar under 
> > /admin/web-inf/lib containing
> > the servlet named
> > com.company.ftpexplorer.FTPExplorerServlet.class
> > 
> > When calling the servlet with following URL:
> > http://localhost:8080/admin/servlet/com.company.ftpexplorer.FT
> > PExplorerServl
> > et
> > the servlet works ok.
> > 
> > I've defined the following <servlet> element on the main 
> > tomcat web.xml
> > 
> > 	<servlet>
> > 		<servlet-name>
> >             controller
> >         </servlet-name>
> > 		<servlet-class>
> >             com.company.ftpexplorer.FTPExplorerServlet
> >         </servlet-class>
> > 	</servlet>
> > 
> > When trying to call the servlet with either URLs:
> > http://localhost:8080/controller
> > http://localhost:8080/admin/servlet/controller
> > 
> > Tomcat can't find the servlet ( 404 )
> > 
> > What is wrong ?
> 
> Creating a servlet name does not create the corresponding
> servlet mapping, such as:
> 
> <servlet-mapping>
> 	<servlet-name>
> 		controller
> 	</servlet-name>
> 	<url-pattern>
> 		/controller
> 	</url-pattern>
> </servlet-mapping>
> 
> then use http://localhost:8080/controller (if you're in the root
> context that is).
> 
> ---
> Michael Wentzel
> Software Developer
> Software As We Think - http://www.aswethink.com
>