Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Question from David Bridgewater's Book

 
Ranch Hand
Posts: 10192
3
Mac PPC Eclipse IDE 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??
 
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).
 
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: 10192
3
Mac PPC Eclipse IDE 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.
 
These are the worst of times and these are the best of times. And this is the best tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic