This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSP and the fly likes Retreiving more than 250 records everytime Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Retreiving more than 250 records everytime" Watch "Retreiving more than 250 records everytime" New topic
Author

Retreiving more than 250 records everytime

Ali Khalfan
Ranch Hand

Joined: Nov 03, 2007
Posts: 126
Hi,

I've written an application in JSTL where the user would need to update some regional settings. So I have a combo box where the user can selected the right country like:








The Method in the class looks like this:








The problem is I have several pages that do this and the user may try to do this several times. This will slow down the system as the user would need to retrieve the records every from the database all the time.

Is there a way I can this to be done only once and then save the List somewhere in memory?

Really appreciate it
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Of course. The country list is the same for all users and will never change? Then you could save it in the application scope.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61066
    
  66

Originally posted by Ali Khalfan:
I have a combo box ...

Correction: it's not a "combo box". That's a desktop control that is not available on the web. It's more correct to call it a "select" or a "dropdown".


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ali Khalfan
Ranch Hand

Joined: Nov 03, 2007
Posts: 126
I apologize..yest it is a select

Paul, can you tell me how to save it in the application score I'd appreciate it
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61066
    
  66

If it were me, I'd read in the values using a context listener, which would trigger once when the app is loaded. Then create the scoped variable in application scope using servletContext.setAttribute().
[ December 28, 2007: Message edited by: Bear Bibeault ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Retreiving more than 250 records everytime