• Post Reply Bookmark Topic Watch Topic
  • New Topic

ServletContext Interface

 
peter hodge
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ServletContext is an interface. It's methods don't have a body. Where is the code for "context.getAttribute()" coming from?
ServletContext context = getServletContext();
String s = (String)context.getAttribute("myAttribute");
What am I missing?
 
Win Yu
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think sevlet API did not have document for ServletContext class, only for interface.That is why you do not know the where it is.But I am not sure.
 
Eduardo Cobian
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This interface like many others comes implemented in the servlet container.You just uses the supertype to acces the methods of the object the servlet container provides for you.(I think).
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!