"Rajendran, Rajarajan" wrote:
>
> I want to read a .properties file through a servlet and get the properties
> and
> set it to a Hashtable. Can anyone please help me out by sample code.

Have you read the javadoc for Properties and Hashtable yet? Normally that should
be enough to answer your question. If you have read the docs, are you having a
specific problem?

First create property file using an editor

Here's pseudo code showing one way to get properties:

create instance of java.io.FileInputStream from property file
create instance of java.util.Properties
call Properties.load(InputStream) method to load properties
call Properties.propertyNames() to get Enumeration of all names
loop through Enumeration of names
  call getProperty(name) to get a property
  if you really want to, store name/property in hashtable

Why are you wanting to store the properties in a Hashtable? Since the Properties
class already stores properties for you using a key-value approach, creating a
Hashtable to store the properties is redundant.

K Mukhar

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to