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

Question from David Bridgewater's Book

 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

16. Which of the following techniques is likely to return an initialization parameter for a JSP page?
(Choose two.)
A. <%= request.getParameter(�myParm�) %>
B. <% String s = getInitParameter(�myParm�); %>
C. <% = application.getInitParameter(�myParm�) %>
D. <%= confi g.getInitParameter(�myParm�); %>
E. <%= getParameter(�myParm�) %>
F. <% Object o = confi g.getParameter(�myParm�); %>
G. <% String s = confi g.getAttribute(�myParm�); %>
H. <% String s = getAttribute(�myParm�); %>

Answer I choose was C and D but book says B and D??
 
Thuwaragan Sundaramoorthy
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"application" will refer to the servlet context (common for the application) but not the servlet config (defined for the particular servlet/jsp page).
 
Amit Goyal
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can the option B be true ? Does the genetated servlet (from jsp)extends from GenericServlet ? Or Implements ServletConfig ?
[ October 11, 2007: Message edited by: Amit Goyal ]
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got my mistake. Thanks for pointing!
 
Thuwaragan Sundaramoorthy
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try the following example if you want:




jsp also transformed to an HttpServlet.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic