Hi all When is recomended to store objects in the instance "application" and when in on static attributes ? As example I have a map which contanins the list of diferent sections of the site, when my jsp receives the param "sectionId" I look in this map to see if I have such key if so, I get the object and display its name amog other things. Now this work perfect but I have this feeling about using application.put() and application.get() would work better to retrive and store the data So, when should I use application and when static atrributes ?
Madhav Lakkapragada
Ranch Hand
Joined: Jun 03, 2000
Posts: 5040
posted
0
Now this work perfect but I have this feeling about using application.put() and application.get() would work better to retrive and store the data When you use application scope, you must also need to know that these variables will be the same in all sessions. When I say all sessions, it means all sessions of all users and different sessions of the same user. These variables can(will be) vary when you re-start your application ie; restart your app server. Now static variables are a totally different typr of variables. They have nothing to do with scope. You can have static variables in any scope - application, session, page, or ???