File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

static class attibutes vs. application objects

 
Zkr Ryz
Ranch Hand
Posts: 187
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5040
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ???

- satya
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic