Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Servlets and the fly likes config.ini file Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "config.ini file" Watch "config.ini file" New topic
Author

config.ini file

Ashik Uzzaman
Ranch Hand

Joined: Jul 05, 2001
Posts: 2370

I want to load the reference of config.ini file from a component (class) that will be used in a servlet. What are the options to direct the location of the file for me. Say I want to put my config.ini file in /docweb/WEB-INF directory. Here docweb is my application's name. I'll read a RandomAccessFile to read/write and forward values to a JSP file.
AFAI understand, I may use a servlet <init-param> to direct the locationas /docweb/WEB-INF/config.ini or use a ResourceBundle like InputStream in = config.getServletContext().getResourceAsStream("WEB-INF/config.ini");
Is these two approaches Ok, or am I missing any syntax here? Should not Tomcat get them automatically? And any alternate approach?
:roll:


Ashik Uzzaman
Senior Member of Technical Staff, Salesforce.com, San Francisco, CA, USA.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: config.ini file
 
Similar Threads
Where to save a file separately for different users in same web server?
relative directory path
ServletContext, its attribute to be shared for all over the Servlet?
Relative path with JAR files
Servlet config in servlets