This week's book giveaway is in the Java 9 forum.
We're giving away four copies of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications and have Sander Mak & Paul Bakker on-line!
See this thread for details.
Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ServletContext Interface  RSS feed

 
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).
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!