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 ?
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.