This week's book giveaway is in the iOS forum.
We're giving away four copies of Classic Computer Science Problems in Swift and have David Kopec on-line!
See this thread for details.
Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Piotr's Exam Simulator Q43 web fragment assembling  RSS feed

 
Ranch Hand
Posts: 1671
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


a. If servlet A defines init param named PARAM through annotations, and servlet B defines init param named PARAM through the Deployment Descriptor, the Deployment Descriptor value has precedence,

b. If servlet A defines init param named PARAM through annotations, and servlet B defines init param named PARAM through the Deployment Descriptor, the annotation value has precedence

c. Init params with different names, defined in annotations and in the Deployment Descriptor are additive (all init params will be present in the final Deplyment Descriptor)

d. url-patterns with different values, defined in annotations and in the Deployment Descriptor are additive (all url patterns will be present in the final Deplyment Descriptor)

The given answers are a, c



But I think the answer a is not correct. Servlet A defines its own init parameter and Serlvet B defines its own init parameter. So, one init parameter can be accessed by serlvet A while another init parameter can be accessed by servlet B (eg. getServletConfig().getInitParameter("PARAM") ) . I don't think the Servlet B's init param defined in DD can override the Servlet A's init param.
 
Ranch Hand
Posts: 611
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Himai,

Actually it's been some time since I've written this question but right now it seems that you're right.

Perhaps the idea was to ask about what happens with init-parameters for a servlet A defined in annotations and in DD. Don't know why the "servlet B" part was involved here.
It would make some sense if it would talk about application-wide parameters like context-params, however it's not configurable through annotations (for a good reason).

The bottom line is - yes, I think you're right - the answer a should not be marked as correct.
 
Creator of Enthuware JWS+ V6
Bartender
Posts: 3094
255
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Piotr!

Good to see you around here

Thanks for answering the question on your question, that deserves a Cow! Although the WCD exam is not so popular anymore like it used to be, everybody is still using your free mock exam. Well done
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!