aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes servlet-mapping question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "servlet-mapping question" Watch "servlet-mapping question" New topic
Author

servlet-mapping question

Joe Man
Ranch Hand

Joined: Feb 17, 2002
Posts: 71
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>


Sun Certified Web Component Developer for the J2EE Platform<br />Sun Certified Programmer for the Java 2 Platform
Aleks Pascoal
Greenhorn

Joined: Jul 16, 2002
Posts: 12
Yes, both are correct. You can use anything starting with a "/", witch refers to the root of application(webapps/yourapplication).
Maha Annadurai
Ranch Hand

Joined: Oct 27, 2002
Posts: 87
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

Joined: Apr 20, 2000
Posts: 3252
Seconding Maha Anna here. "/" is the default servlet, "*" is invalid.
- Peter
 
Don't get me started about those stupid light bulbs.
 
subject: servlet-mapping question