This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of TensorFlow 2.0 in Action and have Thushan Ganegedara on-line!
See this thread for details.
Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning 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
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

servletcontext

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can anybody pls let me know the difference between the methods:
1.getServletContext()
2.getServletConfig().getServletContext()
How does the ServletContext returned by these two methods differ?
Thanks
Neeraj
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can anybody pls let me know the difference between the methods:
1.getServletContext()
2.getServletConfig().getServletContext()
How does the ServletContext returned by these two methods differ?
There is no any difference!
Acctually, they are the same method.
Please note that the GenericServlet implements the ServletConfig interface as well as Servlet interface. And all HttpServlets are children of GenericServlet.
getServletContext() is defined in ServletConfig interface and is implemented in GenericServlet.
So you can use either the getServletContext() of HttpServlet or use the getServletContext() of the ServletConfig.
They are absolutely the same!
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is additional info. Look at the source code of GenericServlet. The method getServletContext() encapsulate calls to getServletConfig().getServletContext()
 
I'm sure glad that he's gone. Now I can read this tiny ad in peace!
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic