Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes JSP and the fly likes Application variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Application variables" Watch "Application variables" New topic

Application variables

Gaelle SMITS

Joined: May 16, 2002
Posts: 23
Hello !
I would like to know : what exactly can I store in the application object ? (using application.setAttribute, for example)
I have a Vector that is used by any user of my intranet site, can I store it in the application object so that anyone can access it ?
Then : how long does such an application variable live ? Is it persistent ?
Thanks !

Gaelle.<br />'Never forget to abuse of good things'
Andy Bowes
Ranch Hand

Joined: Jan 14, 2003
Posts: 171
If you set application attributes they will be available until the application server is shutdown or until they are explicitly removed.
They are NOT persistent i.e. they will not be there if the server is shutdown and restarted. I would advise caution when using them however as you need to take issues like server clustering and they could potentially take up large amounts of memeory.

Andy Bowes<br />SCJP, SCWCD<br />I like deadlines, I love the whoosing noise they make as they go flying past - Douglas Adams
I agree. Here's the link:
subject: Application variables
It's not a secret anymore!