Hi All,
I'm a newbie to programming . I was wondering , whether I could maintain a single file that would contain all the configurable parameters in a project . Example-- As of now I use a Connector class to manage my database connections, and have commented the various modifiable parameters throughout my code. Is there a place/way where I could maintain these parameters so that they can be modified easily (probably at the production environment ), instead of having to go through each file and then make the required change.
Thanks in advance.
If you want to use the classloader, it goes in the classes hierarchy. If you want to read it with the ServletContext, it goes in the WEB-INF hierarchy. If you want it to be independent of the web application (so that customers can edit it), then that's a whole 'nother ball of wax.
Which is your desire? For starters, is it internal or external to the application?
Hm ,
I'd rather want it to be something external to the application so that my client can change the database connectivity URL or pagination size of my webpage without having to recompile the code . It would be great if you could shed some light on that.
I'd start by researching java.util.PropertyResourceBundle.
The challenging part is deciding where to put the file external to the application and how to let the application know where that location is. Especially if it will change from client to client.
Hi Bear,
Thanks for replying!
Two things
1. I find the ResourceBundle approach kinda complex , can you point me to any books that elicit their usage???
2.Secondly,is is it necessary to recompile my code if I were to follow the plain .properties file approach?
Thank you.