重定向到所有客户端中的一个页面(每个客户端是一个SessionScoped ManagedBean)

时间:2012-11-20 23:20:24

标签: java html ajax jsf jsf-2

我有一个包含多个用户的页面(客户端1,客户端2,...),我想按“Salir de reunion”按钮(按钮1)将我重定向到主页(http://localhost:8080/FasMe/faces /所有客户都使用Public / Inicio.xhtml。

每个客户端都是SessionScoped ManagedBean。

enter image description here

我只会被重定向到按下按钮的用户(客户端)中的主页(/Public/Inicio.xhtml)。 我想在所有客户端(浏览器)上进行重定向。我该怎么做?

ReunionActiva.xhtml

    <h:panelGrid id="reunionPanel" columns="2" >
            <h:commandButton value="Salir de Reunion" styleClass="btn" action="#{reunionBean.salirReunion}"  ></h:commandButton>                
    </h:panelGrid>

我的按钮“退出会议”的业务逻辑是:

ReunionManagedBean.java @ManagedBean(name =“usuarioBean”)

public String salirReunion(){

    Cuenta ctaCoordinador=participanteF.getCuentaReunion(reu, reuF.getCoordinadorReunion(reu.getIdReunion()));
    Cuenta ctaParticipante=ctaF.getCuentaByUsuario(usuarioActualBean.getCurrent(), ctaCoordinador.getServidorTareas());

    // If user is ADMIN then I want to delete all user of meeting and close de Meeting
    if(ctaCoordinador.getId().equals(ctaParticipante.getId())){
        Calendar cal = Calendar.getInstance();
        reu.setFechaFin(cal.getTime());
        reu.setEstado("Cerrada"); // It´s meaning setStatus CLOSE
        reuF.modificacionReunion(reu);

        List<CuentaHasReunion> p=participanteF.getAllParticipantes(reu);
        for (Object element : p) {
            CuentaHasReunion part= (CuentaHasReunion) element;
            participanteF.bajaParticipante(part); //Here I delete all user from meeting
            // Here is where I need to do the redirect to all Clients (Client1 , Client2)
         }
        ReunionSingleton.eliminarReunionActiva(reu);
    }
    // If user isn't ADMIN then I only delete user who click the button "salir reunion"
    else{
        participanteF.bajaParticipante(participanteF.getParticipante(ctaParticipante, reu));

    }

    return "/Public/Reunion.xhtml?faces-redirect=true";
}

1 个答案:

答案 0 :(得分:0)

看看ICEfaces Push(似乎是第一个与此相关的孩子)和PrimeFaces Push。通常,Web是基于请求的,因此每个客户端都需要请求刷新。我相信这些允许客户端定期通过ajax询问服务器上是否有任何有趣的请求数据包。如果服务器说是,则客户端说更新我。无论如何,我认为这是你可能正在寻找的。

如果您需要更多同步的东西,您可能需要使用网络套接字或RMI实现某些功能,可能需要通过applet实现。

相关问题