I have searched this for hours, and I've found some stackoverflow questions related to it, but could not find a solution. I have a primefaces dialog that displays the content of a log file. The dialog is shown when pressing a button. My problem is that once the dialog is displayed, the content is never updated. That is, the #{pvtRunner.pvtLog}
method is never called. How can I make my dialog call this method every time it is displayed, not just for the first time?
<h:head>
</h:head>
<h:body>
<p:dialog id="logDialog" header="PVT Log" widgetVar="dlg" height="400" width="600" dynamic="true">
<h:outputText id="logDialogContnet" value="#{pvtRunner.pvtLog}" escape="false"/>
</p:dialog>
<h:form>
<p:panelGrid id="mainPanelGrid" columns="1" styleClass="panelGridBorder panelGridCenter">
....
<p:commandButton id="showLog" value="Show Log" onclick="dlg.show()" type="button" update=":logDialogContnet"/>
</p:panelGrid>
</h:form>
</h:body>
This is the java method that should update the dialog content:
public String getPvtLog() {
String result = "";
try {
File logFile = new File(instanceRoot + "\\config\\ProcessVerification.log");
InputStream fis = new FileInputStream(logFile);
result = readStream(fis);
} catch (IOException e) {
log.severe(e.getMessage());
}
return result;
}
Thanks