

Optionaly, it removes it from session if saving memory is a concern. Then ShowImage searches the image in session (if it is not there for any reason it should load it from database) and returns it. This servlet will load all the images from listaNews from database, and store them in session. Ive been a member of the site since 2008. This can be used for a lot of different things on the site, mostly for buying/selling game items, mostly with the diablo series. The site sells a created currency called forum gold for real money. As you get listaNews form the request attributes, I assume that you allready have a servlet that calculate this list put it in a request attribute and forward to your JSP. d2jsp is a genius idea that has made the creator rich.

Princips : in this answer, I will not separate the controller, service and database layers for brevity. It is easy to use one single query for the whole page, with the option of caching it for the duration of the session, depending on the disponible memory and the expected number of concurrent sessions. If you have plenty of memory in your server, and not too much images, simply preload everything in memory, but I must acknowledge it may not be a real option.īut your problem is really a question of caching the accesses to the database.
