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 Web Component Certification (SCWCD/OCPJWCD) and the fly likes specify a default servlet in DD 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 » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "specify a default servlet in DD" Watch "specify a default servlet in DD" New topic
Author

specify a default servlet in DD

Aaron Raja
Ranch Hand

Joined: Jun 07, 2007
Posts: 206
Please explain ?
How would you specify a default servlet in the deployment descriptor? select one choice

[A]
<servlet-mapping>
<servlet-name>MyDefaultServlet</servlet-name>
<url-pattern>*.*</url-pattern>
</servlet-mapping>
[B]
<servlet-mapping>
<servlet-name>MyDefaultServlet</servlet-name>
<url-pattern>*</url-pattern>
</servlet-mapping>
[C]
<servlet-mapping>
<servlet-name>MyDefaultServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
[D]
<servlet-mapping>
<servlet-name>MyDefaultServlet</servlet-name>
<url-pattern>DEFAULT</url-pattern>

Answer should be [B] but Whizlabs say it is [C] and explain as:
A String containing only the '/' character indicates the 'default' servlet of the application. In this case the case the servlet path is the request URI minus the context path and the path info is null.

Any request, which does not have a mapping, will be served by the default servlet.

===========================================================
Thanks
AR


Thanks, AR
SCWCD 5, SCJP 1.4, OCA (PL/SQL)
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3817

Aaron Raja wrote:Answer should be B but Whizlabs say it is C and explain as:
A String containing only the '/' character indicates the 'default' servlet of the application. In this case the case the servlet path is the request URI minus the context path and the path info is null.
Any request, which does not have a mapping, will be served by the default servlet.


Explanation is directly taken from servlet spec under SRV.11.2 Specification of Mappings (Servlet 2.4 spec). Hope you got the specs


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: specify a default servlet in DD
 
Similar Threads
Doubt in HFSJ sharpen pencil page 695
Servlet Mapping
j2eecertification.com question
Mock Exam Q
servlet mapping question