aspose file tools*
The moose likes JSP and the fly likes jsp servlet mapping in web.xml (Tomcat 5.5) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp servlet mapping in web.xml (Tomcat 5.5)" Watch "jsp servlet mapping in web.xml (Tomcat 5.5)" New topic
Author

jsp servlet mapping in web.xml (Tomcat 5.5)

Jason Liao
Ranch Hand

Joined: Jun 17, 2005
Posts: 59
I have a quesiton about URL mapping in Tomcat 5.5.

If I have a definition in web.xml link this:

<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.asp</url-pattern>
</servlet-mapping>

Which file does Tomcat really get to run? This is the URL:

http://localhost/mywebapp/login.asp

(Supposed I have two files, login.asp and login.jsp, in the root folder.)

Thanks.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

JSP mapping in web.xml is not Tomcat specific.
It's spec driven.
Moving to the JSP forum.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1018
The servlet mapping tells the server which handler (servlet) to use for which files (the url pattern)
The config lines you have there are telling the server that for any request matching "*.asp" should be handled by the servlet called "jsp"

If you look in the [TOMCAT_HOME]/conf/web.xml file, you will find both the servlet handler defined.
Tomcat will run the file login.asp, using the servlet "jsp".
Presumably that tells it to interpret the file login.asp as a jsp.
Jason Liao
Ranch Hand

Joined: Jun 17, 2005
Posts: 59
I got it. Thanks.
 
jQuery in Action, 2nd edition
 
subject: jsp servlet mapping in web.xml (Tomcat 5.5)