Hi,
I've created a Java properties file in my Zimlet and am trying to read the values from it in JSP. The following code does not work...
Code:
private String GetProperties(String prop){
Properties props = new Properties();
String prop_val = "";
//try retrieve data from file
try {
props.load(new FileInputStream("ldap.properties"));
prop_val = props.getProperty(prop);
}
catch(IOException e){
e.printStackTrace();
}
return prop_val;
} ...so I'm assuming that I can't read it with FileInputStream, but will have to read it via a URL Stream like this instead...
Code:
<%
URL myURL=application.getResource("/WEB-INF/myfile.properties");
InputStream in = myURL.openStream();
Properties p = new Properties();
p.load( in );
out.println( p.getProperty("servername") );
%> But I don't know what the URL path to that properties file would be. Also...if it's readable via a URL path by the JSP file....is it then also readable by the URL path in a browser by anyone? ...that would be bad.
I'm trying to abstract a bunch of customizable settings out of the JSP and into a properties file in the Zimlet....just having a little trouble getting it figured out.
Any thoughts?
Thanks,
Matt