> -----Original Message-----
> From: Jamshed Siddiqui [mailto:[EMAIL PROTECTED]]
> Sent: Friday, August 02, 2002 3:47 AM
> To: [EMAIL PROTECTED]
> Subject: accessing file through servlet
>
>
> Hi All,
>
> I would appreciate if anybody of U could help me figure out
> what to pass as an argument to FileInputStream(...) to access
> a properties file from a java class used in a JSP based
> application. I have dumped the database related info in the
> properties file.

Assuming your properties file is in WEB-INF/classes folder you could do like
this

private final static String DEFAULT_PROPERTIES = "/settings.properties";
Properties props = new Properties();

props.load(getClass().getResourceAsStream(DEFAULT_PROPERTIES));

Enumeration propNames = props.propertyNames();

while (propNames.hasMoreElements())
{
        // Write your code here.
}

>
> Jamshed
Vikram.
>
>
>
> ---------------------------------
> Do You Yahoo!?
> Yahoo! Health - Feel better, live better
>
> ==============================================================
> =============
> To unsubscribe: mailto [EMAIL PROTECTED] with body:
> "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set
> JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to