• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

frequently changing init parameters

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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.
 
World domination requires a hollowed out volcano with good submarine access. Tiny ads are optional.
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic