This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring in Action (5th edition) and have Craig Walls on-line!
See this thread for details.
Win a copy of Spring in Action (5th edition) this week in the Spring 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
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

log()  RSS feed

 
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
Again a question extracted from SCWCD Study Kit, p.111 question 8:

Question: which of the following statements can be inserted at //1 so that logMsg may be entered into the servlet log file? Select three
a. log(logMsg);
b. req(logMsg);
c. getServletConfig().log(logMsg);
d. getServletContext().log(logMsg);
e. getServletConfig().getServletContext().log(logMsg);
f. res.log(logMsg)
g. res.getSession().log(logMsg);

Response: a, d, and e.
And I ask myself why d isn't correct also. Method is a method defined in interface. and we are allowed to call directly method because extends that implements . Or this one defines method .
So all seems to be correct, so why isn't it?
I've checked out the errata page but there's no correction.
Thanks for your responses,
Cyril.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd like to answer your question but I couldn't get what you meant to say?
 
cyril vidal
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Excuse me for the bad presentation + an error :
The book's question is the same, but my question is the following:
And I ask myself why d isn't correct also. Method log() is a method defined in ServletContext interface. and we are allowed to call directly getServletContext() method because HttpServlet extends javax.servlet.GenericServlet that implements javax.servlet.ServletConfig
Or this interface defines method getServletContext().
To put it in a nutshell, why can't we call <b>directly</b> getServletContext.log() method in our servlet HttpServlet that implements ServletConfig interface?

Thanks for your responses,
Cyril.
 
Dong Shing
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
D is correct. Who says it's incorrect?
 
cyril vidal
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops! You're right... I must be really tired...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!