What is the difference between a Context, IntialContext,SessionContext and a ServletContext? Can anyone plz give me a clear understanding abt these?
Why you need an explain of the differences between these terms?? They are four absolutely different concepts:
1) Context and InitialContext come from java.naming package and are used in JNDI to locate a context in a naming and/or directory server; Specifically context is an interface ("This interface represents a naming context, which consists of a set of name-to-object bindings. It contains methods for examining and updating these bindings" - Javadoc); InitialContext is a concrete implementor class of Context interface and provides "the starting point for performing naming operations".
2)SessionContext is an interface of the
EJB world. Javadoc says :"The SessionContext interface provides access to the runtime session context that the container provides for a session enterprise Bean instance";
3) ServletContext is the same as SessionContext, but it refers to
Servlet World. It contains informations about the context where your servlets are running.
Hope it helps