Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ServletBean

 
prakash muthu
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I created a servletBean. I want to access the properties from other servlets. Can any one help me regading that problem.
with regards
Prakash
 
maha anna
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to share use of one servlet's info with other servlets withing a single ,whole web application, put the info in 'ServletContext' like the following.

And grab the info in other servlets like this.

The above is a code snippet from one of my working web application, where one servlet creates the database connection pool and others just use it.
regds
maha anna
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic