• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Get The ServletContext

 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We should use GenericServlet or ServetConfig to get the ServletContext? What's the difference do they make?
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doesn't make a difference.
GenericServlet implements ServletConfig (and HttpServlet extends GenericServlet). Therefore, calling "getServletContext()" or "ServletConfig.getServletContext()" from within a GenericServlet method executes the exact same code. Same goes for HttpServlet.
------------------
Miftah Khan
- Sun Certified Programmer for the Java� 2 Platform
- Sun Certified Web Component Developer for the Java� 2 Platform, Enterprise Edition
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic