This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 1016
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)
 
Similar Threads
How can I disable the call to jsp file?
web.xml url-pattern wildcards?
getting exception in JSF Tutorial of JR
servlet-mapping
Cannot invoke servlet by name!