1 Reply Latest reply on Aug 3, 2009 3:31 AM by ilya_shaikovsky

    Launching Modal Dialog using a4jpush

    trevor.flanagan

      Hey
      I am looking to launch a reset password modal dialog using an a4j push. So basically when UserSessionBean gets launched when the session starts it makes a call to the DB to see if the user needs to update their password. If this is the case the binding to the modal dialog is used to set the rendered property to true. On my modal dialog I have an ajax push which rerenders the modal dialog.

      my modal panel jspx

      <?xml version="1.0" encoding="UTF-8" ?>
      <jsp:root xmlns="http://www.w3.org/1999/xhtml" version="2.0" xmlns:jsp="http://java.sun.com/JSP/Page"
       xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:rich="http://richfaces.org/rich"
       xmlns:a4j="http://richfaces.org/a4j">
       <ui:composition>
       <a4j:form>
       <h:form id="resetPasswordPushForm" styleClass="a4jForm">
       <a4j:push id="restPasswordPush"
       eventProducer="#{userSessionBean.addListener}"
       reRender="resetPasswordAjaxPanel"
       />
       </h:form>
       <a4j:outputPanel id="resetPasswordAjaxPanel">
       <h:form id="resetPasswordForm">
       <rich:modalPanel id="resetPasswordModalPanel"
       binding="#{userSessionBean.resetPasswordModalPanel}"
       autosized="true"
       moveable="false"
       >
       <f:facet name="header">
       <h:panelGroup>
       <h:outputText value="Reset Password" />
       </h:panelGroup>
       </f:facet>
       </rich:modalPanel>
       </h:form>
       </a4j:outputPanel>
       </a4j:form>
       </ui:composition>
      </jsp:root>


      addListener method from UserSessionBean

      public void addListener(EventListener listener) {
       synchronized (listener) {
       if (this.listener != listener) {
       this.listener = (PushEventListener) listener;
       if (passwordResetRequired) {
       this.listener.onEvent(new EventObject(this));
       }
       }
       }
       }


      The inclusion of the panel in another jspx
      <a4j:include viewId="resetPasswordModalPanel.jspx" />


      My problem is that the dialog does not appear.

      First is this an appropriate way to do this?
      If yes then what am I doing incorrectly?
      If no then what is the best approach?

      Any help/guidance would be greatly appreciated.