Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

log()

 
cyril vidal
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.
 
Dong Shing
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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic