Solved

Reading ini file from JSP

Posted on 2000-04-23
8
1,427 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
 
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Java 1603 Error 2 42
noX challenge 17 76
eclipse java  build path 6 21
Java Timer (static) 9 15
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now