alerts
my page uploads a file and when the file is successfully loaded I am supossed to display a message.. So if was able to do that by having a boolean in one class and I pull its value and use it for the rendered attribute of an output text..
It works fine since the boolean has a setter and getter.. only problem is that I can't seem to reset the rendered attribute back to false.. so that when the user searches something else the Success Message won't have to display..
any suggestions, like perhaps an alert box in JSF?
here are parts of my code..
JSF><h:commandButton id="e2Csv" value="Export to CSV" action="#{statisticsController.createString}" disabled="#{empty statisticsController.status}"/>
<h:outputText id="msg" rendered="#{statisticsController.upload}" value="File Successfully Exported!"/>
JAVA->
privateboolean Upload=false;
publicboolean isUpload(){
return Upload;
}
publicvoid setUpload(boolean upload){
Upload = upload;
}
String str ="";
StringBuilder sb =new StringBuilder();
String attVal="";
String allSer="";
String unqSer="";
sb.append("Summary from "+dateFrom+" to "+dateTo+"\n");
sb.append("Total,Number of Searches");
if(total.getBrandTotal()!=0){
str ="By Brand";
sb.append("\n\n"+str+","+total.getBrandTotal()+"\n");
sb.append("Brand,All Searches,Unique Searches\n");
for (StatisticsResultBreakdown el : breakdownForBrand){
attVal = el.getAttributeValue();
if(attVal.contains(",")){
attVal ="\""+attVal+"\"";
}
log.debug(attVal);
allSer = el.getAllSearches();
unqSer = el.getUniqueSearches();
sb.append(attVal+","+allSer+","+unqSer+"\n");
}
}
setCsvText(sb.toString());
log.debug(getCsvText());
setUpload(fileControl.uploadCsv(getCsvText()));

