Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp servlet mapping in web.xml (Tomcat 5.5)

 
Jason Liao
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSP mapping in web.xml is not Tomcat specific.
It's spec driven.
Moving to the JSP forum.
 
Stefan Evans
Bartender
Pie
Posts: 1669
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it. Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic