Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Context / InitialContext

 
Ben Roy
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know much about ServletContext as I have been primarily working with jsp/javabeans/EJB and not really with servlets at all. If anyone knows, is it possible for me to retrieve ServletContext information from InitialContext? Is it part of the same "tree" or are they completely separate and unrelated?
 
Carl Desborough
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont know of any connection (other than the name) between servlet and initial contexts ...
InitialContext is where you can get register and get access to objects in JNDI.
ServletContext allows a servlet to communicate with its container. Objects can be stored in and retrieved from a ServletContext (set and getAttribute) but i dont think its related to the InitialContext names.
 
Danny Mui
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another point, I believe that ServletContexts can only be retrieved from servlets as well (unless you JNDI the object).
 
maha anna
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Carl,
Are you the famous 100% SCJP from AUS ? Just curious.
regds
maha anna
 
Carl Desborough
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
famous? no ... but yes i did get 100% in scjp and i am from australia.
Originally posted by maha anna:
Carl,
Are you the famous 100% SCJP from AUS ? Just curious.
regds
maha anna

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic