• 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

frequently changing init parameters

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 893
Tomcat Server Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic