• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

To load the data for the entire application

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
For my web pages development using struts, I have an issue. We get the a list of 600 data from the database which is to be loaded in the application each time we call it. This is how it goes now.
But is there a way that the entire data can be loaded in the application at once and use the data wherever needed.
 
Ranch Hand
Posts: 136
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just a suggestion, try to group this 600 data into groups on basis of some fields preset in it. Pull the data based on the groups on a need to display basis so that you can reduce the load.
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Brahmani Ganduri wrote:Hi
For my web pages development using struts, I have an issue. We get the a list of 600 data from the database which is to be loaded in the application each time we call it. This is how it goes now.
But is there a way that the entire data can be loaded in the application at once and use the data wherever needed.



600 db rows , is too big to walk with. If you do not care about the memory usage plus any performance impact, you can extend ContextListener class and store the rows(ResultSet object) in context scope..

If you memory is an issue, then do what Balagopal Kannampallil suggest.. Access them whenever they needed.
 
Brahmani Ganduri
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess, I was not clear with my post. Let me be clear.

I am using a list of 600 cities for my index page. In my index page, there is a text box which works as an auto suggester with the 600 cities. Is there a way I can load the list of 600 cities (which i am getting from db)
JUST ONE TIME, into my jsps for the entire application. This will increase the performance of my index page.
 
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you mean that once the data is loaded and after that if the page is refreshed it wont reload the data again?
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Brahmani Ganduri wrote:I guess, I was not clear with my post. Let me be clear.

I am using a list of 600 cities for my index page. In my index page, there is a text box which works as an auto suggester with the 600 cities. Is there a way I can load the list of 600 cities (which i am getting from db)
JUST ONE TIME, into my jsps for the entire application. This will increase the performance of my index page.



This is the general thing a web designer face many time, when you need to develop page where a drop down contains name of country, states, what is and what not..

The general and simple technique is to place all the 600 cities in a JSP/HTML (<option>city</option>)page it self.. It won't cause any problem, provided the name of cities won't change frequently..
 
Brahmani Ganduri
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Swastik Dey wrote:Do you mean that once the data is loaded and after that if the page is refreshed it wont reload the data again?



Hi
We are actually trying to get the list of stations, which match the first 3 letters of the station. We are using xmls for this, though ajax is a good one to do it.
Our issue is, once the stations are loaded in the application, they should not be reloaded or hit the database again.
Scope of the stations should be application. The station list is dynamic.

If any inputs on this, please reply.

Thanks all


 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Brahmani Ganduri wrote:Is there a way I can load the list of 600 cities (which i am getting from db)
JUST ONE TIME



Use Singleton java class.For more detail google it
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Or put the list in application scope on startup.
 
Brahmani Ganduri
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:Or put the list in application scope on startup.



Thanks all for your replies.

David, we have actually tried to use the scope application also. But that was not working.
Now, we are trying to change the search pattern. As said, previously we were using xmls to get the station name which was performance issue.
Now, we are trying to use AJAX.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can putting data into the application context "not work"?
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A context listener and application scope will work fine. If that's "not working" for you, you are doing it wrong.

Using Ajax for something like this would be ridiculous.
 
Brahmani Ganduri
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:A context listener and application scope will work fine. If that's "not working" for you, you are doing it wrong.

Using Ajax for something like this would be ridiculous.



The station list is a drop down. and we are using the dropdown list wherever needed in the site. Application scope was not working.
Anyways, I will check again the whole code.

 
Bear Bibeault
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Brahmani Ganduri wrote:Application scope was not working.


So you just gave up instead of trying to find out why it was "not working"? (whatever that means)

Please read this for more information.
 
Brahmani Ganduri
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you, for your response.
 
Nothing? Or something? Like this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic