Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1486
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

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