Eu tenho um panelgrid e gostaria de atualizar ele pelo bean
panelgrid:
<h:panelGrid id="statusServer" columns="1">
<c:if id="ifON" test="#{gerenciarOcorrenciaBean.servidorON==1}">
<h:graphicImage library="images" name="ON.jpg" />
</c:if>
<c:if id="ifOFF" test="#{gerenciarOcorrenciaBean.servidorOFF==1}">
<h:graphicImage library="images" name="OFF.png"/>
</c:if>
<p:commandButton value="Pingar" actionListener="#{gerenciarOcorrenciaBean.doCommand()}"/>
</h:panelGrid>
e o metodo onde eu quero que ele atualize:
public void doCommand()
throws IOException
{
commands = new ArrayList<String>();
commands.add("ping");
commands.add("10.14.4.77");
// commands.add("-t");
String s = null;
ProcessBuilder pb = new ProcessBuilder(commands);
Process process = pb.start();
BufferedReader stdInput = new BufferedReader(new InputStreamReader(process.getInputStream()));
BufferedReader stdError = new BufferedReader(new InputStreamReader(process.getErrorStream()));
// read the output from the command
System.out.println("Here is the standard output of the command:\n");
while ((s = stdInput.readLine()) != null)
{
if(s.equals("Esgotado o tempo limite do pedido.")){
System.out.println(s);
servidorOFF=1;
servidorON = 0;
FacesContext.getCurrentInstance().getPartialViewContext().getRenderIds().add("statusServer");//tentativas
RequestContext.getCurrentInstance().update("statusServer"); //tentativas
}
else if (s.contains("Host de destino inacess¡vel")){
System.out.println("Host de destino inacessivel");
servidorOFF =1;
servidorON=0;
}
else if(s.contains("Resposta")){
System.out.println("resposta bem sucessedida");
servidorOFF=0;
servidorON = 1;
System.out.println(s);
RequestContext.getCurrentInstance().update("statusServer");
}
}
como vocês podem notar eu tentei alguns códigos logo acima mais não funcionaram.
alguma ideia agradeço desde já, obrigado.