• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question for url-pattern

 
Maria Tan
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello:
In the web.xml, there is a Servlet-mapping element, including servlet-name and url-pattern.
1)<url-pattern>/test/*</url-pattern>
2)<url-pattern>/test/</url-pattern>
3)<url-pattern>/test</url-pattern>
I am just wondering what is the difference among them.
Thanks in advance
Maria
 
John Williamer
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1)<url-pattern>/test/*</url-pattern>
This will map urls like http://localhost:8080/webapp_name/test/random/whaever

2)<url-pattern>/test/</url-pattern>
This just maps the /test/ so you have to use the last slash to access it
3)<url-pattern>/test</url-pattern>
This is the same as above except that it must not have the last slash in the above example
hope this helps
 
Maria Tan
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot
Maria
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic