This week's book giveaway is in the General Computing forum.
We're giving away four copies of Emmy in the Key of Code and have Aimee Lucido on-line!
See this thread for details.
Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • 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
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Handling session time out

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I have a list of images for a particular item in my database.when i display the details of this item i display the first image from the list along with.
onclicking a link for next image a servlet render next image from session .

i am dacing a problem in handling session .onclicking the link im changing the
image src from a java script but i can't distinguish whether session is available or not .

Can anybody help me on how to handle this ? will dwr help ?

thanks & regards
Anuja Karthikeyan
 
Marshal
Posts: 67293
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

i am dacing



dacing?

And what does the session have to do with your images?
 
anuja Edathu
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault ,
I am sorry for the spelling mistake i made , i meant "facing" .

Now my images are stored in DB and to reduce db access i kept it in session.
So once the session gets time out image won't be available any more .which results in a blank space in image are in jsp .

Thanks & Regards ,
Anuja K
 
Bear Bibeault
Marshal
Posts: 67293
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the images are called up so seldomly that the session has time to expire, I wonder if caching is really saving you much.

In any case, your caching code sounds like it's not well architected. It should be coded such that code asking for the image doesn't care whether the image is cached or not. The caching code can check the session, and if the image is there, it serves it from the cache. If not, it reads the image into the cache prior to serving.

This not only abstracts the whole process nicely, you no longer need to worry about session expiry since if the session expires, the code is smart enough to reload the image in the new session.
 
Tick check! Okay, I guess that was just an itch. Oh wait! Just a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!