This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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: 3825

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