File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlet-mapping question

 
Joe Man
Ranch Hand
Posts: 71
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm confused on what can be assigned to a <url-pattern> inside <servlet-mapping> element. Are the following correct?
<servlet-mapping>
<servlet-name>TestServlet</servlet-name>
<url-pattern>*</url-patteren>
</servlet-mapping>
</servlet-mapping>
<servlet-name>TestServlet2</servlet-name>
</url-pattern>/</url-patteren>
</servlet-mapping>
 
Aleks Pascoal
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, both are correct. You can use anything starting with a "/", witch refers to the root of application(webapps/yourapplication).
 
Maha Annadurai
Ranch Hand
Posts: 87
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think just a * for <url-pattern> is not enough.
The servlet spec does not say anything specifically for just "*" values.
I tested with Tomcat. It gives 404 error even for index.html under the context root.
Can others comment on it?
Thanks!
Regards,
Maha Anna
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seconding Maha Anna here. "/" is the default servlet, "*" is invalid.
- Peter
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic