• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Question from David Bridgewater's Book

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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??
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got my mistake. Thanks for pointing!
 
Thuwaragan Sundaramoorthy
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try the following example if you want:




jsp also transformed to an HttpServlet.
 
I am not a spy. Definitely. Definitely not a spy. Not me. No way. But this tiny ad ...
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic