File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes how to initiate hashtable and linklist Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "how to initiate hashtable and linklist" Watch "how to initiate hashtable and linklist" New topic
Author

how to initiate hashtable and linklist

pradeep gamage
Ranch Hand

Joined: Aug 03, 2009
Posts: 85

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

Software Engineer(BSC):SCJP 1.5
(Knowledge is power when applied)
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

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


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
pradeep gamage
Ranch Hand

Joined: Aug 03, 2009
Posts: 85

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

Joined: Feb 19, 2008
Posts: 2902
    
    1

May be Serlvet context listener helps:
http://download.oracle.com/javaee/6/api/javax/servlet/ServletContextListener.html
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
pradeep gamage
Ranch Hand

Joined: Aug 03, 2009
Posts: 85

I have solved my problem by using spring. i have add spring bean to execute when application loading time.

Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

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
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

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

Joined: Aug 03, 2009
Posts: 85

Thanks all valuable posts................
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to initiate hashtable and linklist