Solved

Reading ini file from JSP

Posted on 2000-04-23
8
1,450 Views
Last Modified: 2012-06-27
How do I read an ini file from a Java server page?
0
Comment
Question by:ssindhu
  • 2
  • 2
  • 2
  • +2
8 Comments
 

Author Comment

by:ssindhu
ID: 2742975
.
0
 
LVL 4

Expert Comment

by:jerch
ID: 2743118
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
 
LVL 16

Expert Comment

by:heyhey_
ID: 2743185
you can use java.util.Properties object which knows how to load & save it from configuration file ...
0
Industry Leaders: 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!

 
LVL 3

Expert Comment

by:ovidiucraciun
ID: 2743319
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
 

Author Comment

by:ssindhu
ID: 2743768
Thanks a lot Jerson your idea works..
Thanks to others also.
0
 
LVL 4

Expert Comment

by:jerch
ID: 2745909
you're welcome :)
0
 

Accepted Solution

by:
shgj earned 100 total points
ID: 2750526

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

Expert Comment

by:heyhey_
ID: 2750552
WHOW WHOW whoooooooooooooooooooowwwwwwwwww
0

Featured Post

Industry Leaders: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Android development question 2 75
Desingning Refactoring existing code 2 31
Chrome and Firefox Java 5 67
Code Coverage and Coding Standards 2 43
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question