ok.. so I read it over and now I have a vague idea on how to code it..
the thing is I keep getting the "The system cannot find the file specified" error.. do I have to include the path or something?
here's my code.. i call this method in JSF
public boolean LoadAllIpAddresses(String ipAdd) {
log.debug("LoadAllIpAddresses");
Properties props = new Properties();
String result = "";
boolean res = false;
try{
InputStream is = new FileInputStream("IPAddresses.properties");
props.load(is);
result = props.getProperty(ipAdd);
log.debug("propfileresult"+result);
if(result==null){
res = false;
}
else
res = true;
}
catch(Exception e){
log.debug("error at LoadAllIpAddresses "+e.getMessage());
}
return res;
}
okay I was able to make the properties file work but now I've got a different problem.
<h:outputText styleClass="greenBoldText" value="#{messageController.message}"/>
This output text's value is from a Java Controller. There are no errors or exceptions thrown but unfortunately for me the message does not display.. I know that I am able to populate the message variable.. And the message controller is a managed bean in my faces-config file
here's my code snippet for the Java Controller
private String message="";
public String getMessage() {
return message;
}
public void setMessage(String message) {
ApplicationResources application = (ApplicationResources) FacesUtil.instance().getApplicationMapValue(FacesContext.getCurrentInstance(), "applicationRes");
log.debug("application:" +application);
log.debug("message="+message);
message = (String)application.getMessageProps().getProperty("1");
log.debug("message="+message);
if(message.equalsIgnoreCase("saveToDatabaseSuccess")){
message="Supplier Successfully Saved to Database!";
log.debug(message);
}
else if(message=="saveToDatabaseFailure"){
message="Error in Saving. Please Contact System Administrator";
}
else if(message=="saveParentCatSuccess"){
message="Parent Category Saved!";
}
else if(message=="saveChildCatSuccess"){
message="Child Category Saved!";
}
else if(message=="blank"){
message="";
}
else{
message="Error in system!";
log.debug("Error in system");
}
this.message = message;
}
now here's my code snippet for the faces-config
<managed-bean>
<managed-bean-name>messageController</managed-bean-name>
<managed-bean-class>com.shipserv.webui.controllers.MessageController</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
wether its a session or request scope it still won't display I can't seem to find out what is wrong with it..
Thanks in advance..