struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris <christal...@yahoo.fr>
Subject Re: Struts 2.3.15.1 How to read external properties files or conf files
Date Sun, 08 Sep 2013 08:58:00 GMT
Thanks Leonidas



________________________________
Hi there,


webwork used to have a class that would easily read
external sources like xml files, but i do not recall the class name now. If you want to read
from simple property files you could use something 
like :

String path = ServletActionContext.getServletContext().getRealPath("");

Properties prop = new Properties();

try {
    // load properties from the class path
    prop.load(new FileInputStream(path
            + "//WEB-INF//classes//ldapconf.properties"));
} catch (IOException ex) {
    ex.printStackTrace();
}


//get parameter param1
String param1 = prop.getProperty("param1"); 

Regards
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message