jeudi 29 décembre 2016

ajax status custom jsf 2 update from bean

I have a slow process with about 10 steps, and I would like to inform the user in which step the process is, I would like to update some msg on the screen with each process.

I tried the following way but I did not succeed, because only the last msg is rendered, and then it executes the whole process. I made an outputext and a binding called msgAjax, has anyone had it or do you know how to solve it?

public void processar(Sigtap sigtap) {
    try {
        this.sigtap = null;
        this.sigtap = sigtap;
        if (sigtap != null) {
            RequestContext context = RequestContext.getCurrentInstance();
            msgAjax.setValue("Baixando arquivo sigtap..");
            context.update("msgAjax:painel");
            Download.gravaArquivoDeURL(sigtap.getUrl(), path + sigtap.getCompetencia().getDescricao() + "\\", sigtap.getCompetencia().getDescricao() + ".zip");
            msgAjax.setValue("Extraindo arquivo..");
            context.update("msgAjax:painel");
            Download.unZipIt(path + sigtap.getCompetencia().getDescricao() + "\\" + sigtap.getCompetencia().getDescricao() + ".zip", path + sigtap.getCompetencia().getDescricao() + "\\");
            session = HibernateUtil.currentSession();
            financiamentoDao = new FinanciamentoDao(session, Financiamento.class);
            msgAjax.setValue("Financiamento");
            context.update("msgAjax:painel"); 




Aucun commentaire:

Enregistrer un commentaire