aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes frequently changing init parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "frequently changing init parameters" Watch "frequently changing init parameters" New topic
Author

frequently changing init parameters

nagalatha mitta
Greenhorn

Joined: Jun 11, 2007
Posts: 26
hi friends
In HFSJ book page 153-they have given that"if the values of your init parameters are going to change frequently,you're better off having your servlet methods get the values from a file or database"

if anybody knows "how to write a code to store init parameters in a file or database and to get init parameters from a file or database" please let me know


thanks in advance
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

Init parameters are something like deploy-time constant. You can't change them. If you wish to change them, you will need to redeploy your web app.

Storing init parameters to database for file is surely possible, but why do you want to do that?

Actually what the book is trying to say is that if you have values that change frequently, use database or a file to retrieve those values and not use init parameters and store them into database/file.


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Remko Strating
Ranch Hand

Joined: Dec 28, 2006
Posts: 893
I store the most of my init parameters in a database, because in a database you can easily search, etc. It could also be that I've more experience with databases.

By the init method you could get the values by a helper class which gets you values from the database. Mostly I use a query which stores the values in a HashMap from which you can retrieve your init values by a getting method which uses the HashMap for getting the values.

A big advantage is that you can store your parameters user dependent and the user can change them if you want to.


Remko (My website)
SCJP 1.5, SCWCD 1.4, SCDJWS 1.4, SCBCD 1.5, ITIL(Manager), Prince2(Practitioner), Reading/ gaining experience for SCEA,
 
 
subject: frequently changing init parameters