aspose file tools*
The moose likes JSP and the fly likes Getting the list from DB once and using across all jsp pages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Getting the list from DB once and using across all jsp pages" Watch "Getting the list from DB once and using across all jsp pages" New topic
Author

Getting the list from DB once and using across all jsp pages

Guna sekar
Ranch Hand

Joined: May 18, 2010
Posts: 32
Hi,


An application has drop down which is to be displayed in all the jsp pages. Values for the drop down should be fetched only once(ie DB hit should be only once). Is there any other apart from keeping the list in session?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61426
    
  67

If it's the same for all users, why would you keep it in each session?

In such a case, I'd read it in using a context listener and then store it in application scope.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Guna sekar
Ranch Hand

Joined: May 18, 2010
Posts: 32
Hi Bear,


Thanks for your reply. Is there any other way?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61426
    
  67

About 50 bazillion. But that's the way that I'd do it.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Getting the list from DB once and using across all jsp pages