Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mock question-InitParameter

 
Rancy Chadha
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Please help me out with this question:
What happens if you set a Web application-wide parameter through ServletContext, but don't provide a value?
A) This cannot happen.
B) An exception will be thrown.
C) Retrieving this parameter will return a string containing a servlet container version number.
D) Retrieving this parameter will return a string containing a servlet container name
Right answers are C & D.

I have tried this by not giving any value for <param-value> of <context-param> element. But I get blank I dont get the output that should be given as per this question. Probably I have not understood the question properly. Can anyone help me out with this?
 
Satya Maheshwari
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you please explain this line:
"set a Web application-wide parameter through ServletContext"

How is this done?
 
Atul Sawant
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are correct. When there is no value set for the parameter then you will see a 'blank'. I think the question means something else and i am not sure what it is trying to ask.
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Ranchy]:

I have tried this by not giving any value for <param-value> of <context-param> element. But I get blank I dont get the output that should be given as per this question.


Me too got the question in the same way as you. We get blank string.
If the question is something else, I am eager to know as well.



Thanks,
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic