Hi
We often have the requirement of reading properties from a file placed inside the ADF application itself . We use this mainly for easy access of properties that uses in many locations across the application.
Code to read property file in java:
InputStream st = null;
Properties prop = new Properties();
st =
Thread.currentThread().getContextClassLoader().getResourceAsStream("/com/view/read.properties);
try {
prop.load(st);
String personID=prop.getProperty("Employee") ;;
}catch (Exception e) {
logErrorStackTrace(e);
}finally{
try{
if (st !=null) {
st .close();
}
}catch (Exception e) {
logErrorStackTrace(e);
}
}
*Must close the st after usage
Code to read property file in jsff:
Declaration / import :
<c:set var="propfile"
value="#{adfBundle['com.view.read']}"/> // read is the property file name
Usage:
<af:outputText value="#{propfile.outputtext}"
id="ol1"/>
Thank You!!
Never stop learning ...
We often have the requirement of reading properties from a file placed inside the ADF application itself . We use this mainly for easy access of properties that uses in many locations across the application.
Code to read property file in java:
InputStream st = null;
Properties prop = new Properties();
st =
Thread.currentThread().getContextClassLoader().getResourceAsStream("/com/view/read.properties);
try {
prop.load(st);
String personID=prop.getProperty("Employee") ;;
}catch (Exception e) {
logErrorStackTrace(e);
}finally{
try{
if (st !=null) {
st .close();
}
}catch (Exception e) {
logErrorStackTrace(e);
}
}
*Must close the st after usage
Code to read property file in jsff:
Declaration / import :
<c:set var="propfile"
value="#{adfBundle['com.view.read']}"/> // read is the property file name
Usage:
<af:outputText value="#{propfile.outputtext}"
id="ol1"/>
Thank You!!
Never stop learning ...
No comments:
Post a Comment