Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Object Reference to Servlet(Urgent)  RSS feed

 
Angela D'souza
Ranch Hand
Posts: 469
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to create instance of some objects at startup of tomcat. I have many servlet which needs reference of those objects in order to use object APIs.How can servlet get reference of those object???
Thanks,
Angela
 
karl koch
Ranch Hand
Posts: 388
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

use the servlet context to "store" those objects (as in a HashMap: key-value pairs). All your servlets have access to this ctx and can get back the objects.

k
 
Angela D'souza
Ranch Hand
Posts: 469
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have simple example? or Do you know the API to do this???
Thanks a lot,
Angela
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The full servlet and JSP API Javadocs come with the Tomcat download. You can also download the servlet and JSP specifications as a PDF document from java.sun.com. If you are going to be working with servlets you might as well learn how to use these sources.
Bill
 
Angela D'souza
Ranch Hand
Posts: 469
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by karl koch:
hi

use the servlet context to "store" those objects (as in a HashMap: key-value pairs). All your servlets have access to this ctx and can get back the objects.

k

Can I get access of object which are outside Tomcat server???
Thanks,
Angela
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!