• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1499
  • Last Modified:

Reading ini file from JSP

How do I read an ini file from a Java server page?
0
ssindhu
Asked:
ssindhu
  • 2
  • 2
  • 2
  • +2
1 Solution
 
ssindhuAuthor Commented:
.
0
 
jerchCommented:
Hi ssindhu...
I don't think it's good design for your jsp to read from an ini file. I suggest you to create an initializing servlet. The primary task of the servlet is to load all configuration data to the servlet context, which is like the global variables of servlet and jsp. These data are shared by different servlet and jsp.  Another alternative is to use the getInitParameter() method. Different web servers have different way of setting the init parameters.

best regards...
Jerson
0
 
heyhey_Commented:
you can use java.util.Properties object which knows how to load & save it from configuration file ...
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
ovidiucraciunCommented:
or if you realy want an ini file, to provide a portable solution, use instead a ini file an XML file and use for parse it the last parser from sun
0
 
ssindhuAuthor Commented:
Thanks a lot Jerson your idea works..
Thanks to others also.
0
 
jerchCommented:
you're welcome :)
0
 
shgjCommented:

Properties re=new Properties();
      InputStream is=getClass().getResourceAsStream (filename);      
      try
            {
            re.load (is);
            }catch (Exception e)
                  { e.printStackTrace ();}
      
      Enumeration en=re.keys ();
0
 
heyhey_Commented:
WHOW WHOW whoooooooooooooooooooowwwwwwwwww
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now