• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to initiate hashtable and linklist

 
Ranch Hand
Posts: 85
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am developing project by using Spring 3.0, JSF 2 . so what my requirement is when application load at first time load the some data to HashTable and ArrayList(whatever Collection). this is my web.xml file


how i can use init param to load some data to HashTable or ArrayList. give me your valuable comment..

Thanks in Advance
 
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
Using web.xml:
http://wiki.metawerx.net/wiki/Web.xml.InitParam

Using spring app context:
http://static.springsource.org/spring/docs/3.0.x/reference/xsd-config.html#xsd-config-body-schemas-util-list
 
pradeep gamage
Ranch Hand
Posts: 85
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for valuable link.what I want is when application load at first time load the some data to HashTable and ArrayList from database table. how i can manage it?
Thanks in advance..........
 
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
May be Serlvet context listener helps:
http://download.oracle.com/javaee/6/api/javax/servlet/ServletContextListener.html
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sagar Rohankar wrote:May be Serlvet context listener helps:
http://download.oracle.com/javaee/6/api/javax/servlet/ServletContextListener.html



Sorry Sagar. How do you even know if they have a web application?

For a Spring application, and for some simple task like what is needed here, a ContextListener is way overkill.

So an init-method is just a method that runs right after an object gets instantiated and all its dependencies and properties have been set.






SomeClass will be instantiated by Spring, the dataSource dependency will be injected, any properties will be set, then the someMethod method will be called.

That is how init-method works.

Mark
 
pradeep gamage
Ranch Hand
Posts: 85
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have solved my problem by using spring. i have add spring bean to execute when application loading time.

 
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

Mark Spritzler wrote:

Sagar Rohankar wrote:May be Serlvet context listener helps:
http://download.oracle.com/javaee/6/api/javax/servlet/ServletContextListener.html


Sorry Sagar. How do you even know if they have a web application?


Well, I guess that from the web.xml posted!

Definitely, for init-method
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sagar Rohankar wrote:Well, I guess that from the web.xml posted!



DOH!. See how much I pay attention to the details. ;)

Mark
 
pradeep gamage
Ranch Hand
Posts: 85
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks all valuable posts................
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic