• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Application variable

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my current web applicatin has to be filled with application scope variables, what is the best way to handle it. Is it possible to place a bean or serialsed bean on the context(application scope) ... every operation is based on application variable only so there will be lot of data changes in it...

eg i want to store all the user who are login and using the web application , and many such details ...

everything i want to store in the application scope instead of cookies or sesssion.

Can anyone tell me best practise for it?

i want to store in a place like servlet context....
 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Not able to make out..
Could you please elaborate with an example?



 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Arvind Subramanian wrote:
everything i want to store in the application scope instead of cookies or sesssion.

Can anyone tell me best practise for it?


javax.servlet.http.HttpSession (J2EE 1.4)

Session information is scoped only to the current web application (ServletContext), so information stored in one context will not be directly visible in another.

Doesn't that suffice?

I think I am in the same place as the parent
 
Arvind Subramanian
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no i want to store in a place like servlet context....
 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure if this is best practice or not but maybe you could create a class with a static method that creates an instance of the class when called the first time and returns only that instance when called every time after that? I think this is the idea behind the singleton pattern... Anyway, that instance could hold any application wide variables.
 
Mohamed Inayath
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming the problem:

You can store the data in application context where all the user/request need to access.
Example :
System parameters.
EJB home/ejb objects cache.

This is are all static data available to all the users.

It depends what exactly you need to keep in application context.Then only we can decide the best practice.


 
Arvind Subramanian
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the discussion.. i completed my latest portal , with help of servlet context. what i tried to achieve was the interaction between the different user who are using the portal without the help of DB. i stored the each user in the context and make the other user to read from it about their status....


thanks for all and javaranch....
 
I RELEASE YOU! (for now .... ) Feel free to peruse this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic