incubator-adffaces-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Causevic, Dzenan" <dcause...@navisite.com>
Subject RE: Must refresh page to get returnListener value from dialogs
Date Fri, 23 Feb 2007 15:58:00 GMT
This is exactly like calendar functionality, where you have a month
opened in a new window and you click on the date, and that date
automatically gets filled in into the parent window.

 
_______________________________
Dzenan Causevic 
Web Applications Developer 
NaviSite, Inc.
315-453-2912 x5346 (Office)
315-278-7371 (Cell)    
www.NaviSite.com
 

-----Original Message-----
From: Causevic, Dzenan [mailto:dcausevic@navisite.com] 
Sent: Thursday, February 22, 2007 4:44 PM
To: adffaces-user@incubator.apache.org
Subject: RE: Must refresh page to get returnListener value from dialogs

Anybody any idea why I have to do hard refresh in order for page to
display the values? 

Also I noticed that page blinks once the external window is closed but
it is obviously not enough, so the browser Refresh button needs to be
clicked on.

 
_______________________________
Dzenan Causevic 
Web Applications Developer 
NaviSite, Inc.
315-453-2912 x5346 (Office)
315-278-7371 (Cell)    
www.NaviSite.com
 
-----Original Message-----
From: Causevic, Dzenan [mailto:dcausevic@navisite.com] 
Sent: Thursday, February 22, 2007 10:23 AM
To: adffaces-user@incubator.apache.org
Subject: Must refresh page to get returnListener value from dialogs


I use dialogs for user to be able to retrieve his password if he forgets
it. On the login page I have a link 'forgot your password' that opens up
external window via dialogs where the user can enter his username and
click on the 'Send' button for his password to be sent to him. Now I
want the external window to close automatically upon clicking on Submit
button, and the message (success or failure) to be displayed in the
parent window from which external window was originally called. I use
returnListener for this however my problem is I have to refresh the page
to see the message. After I submit send button, external window closes,
but the message is not being displayed on the parent page. I have to
refresh the page it in order to be able to see it.

loginJSF.jsp is a parent page:
                      <h:panelGroup> 
                          <tr:outputText value=""

 
binding="#{passwordRetrDialog.output}"
                                         rendered="false"/>           
                          <tr:commandLink id="buddonId"
 
inlineStyle="margin-left:10px;"
                                          action="dialog:passwordRetr" 
                                          text="Forgot your password?" 
                                          useWindow="true"
windowWidth="500" 
                                          partialSubmit="true" 
 
returnListener="#{passwordRetrDialog.returned}"/>             
                      </h:panelGroup>

passwordRetrJSF.jsp is JSF page that opens in external window:
                     <h:panelGroup>
                          <h:outputText escape="false" value="<!--Enter
E-mail -->" />
                          <h:outputText id="userName2L"
styleClass="labelText" value="E-mail*" />
                          <h:inputText id="User_Name2TI_R"
styleClass="inputText" value="#{passwordRetr.userName}" /> 
                          <tr:commandButton id="retrieveB"
action="#{passwordRetr.send}" text="Submit"
inlineStyle="margin-left:10px;" />
                      </h:panelGroup>

PasswordRetrBean.java:
import org.apache.myfaces.trinidad.context.RequestContext;

public class PasswordRetrBean {
    
    private String _userName;
    
    /** Creates a new instance of PasswordRetrBean */
    public PasswordRetrBean() {
        setUserName("address@host");
    }

    public String getUserName() {
        return _userName;
    }

    public void setUserName(String userName) {
        this._userName = userName;
    }
    
    public String send()
    {
        String firstPart = "first part ";
        String secondPart = " second part";
        // check if user name is valid using getUserName()
        // if yes then
            // firstPart = "something ";
            // secondPart = " something";
        // if no then
            // firstPart = "something else ";
            // secondPart = " something else";
        // end of if statement
 
RequestContext.getCurrentInstance().returnFromDialog(firstPart+getUserNa
me()+secondPart, null);    
        return null;
    }    
}

PasswordRetrDialogBean.java:
import org.apache.myfaces.trinidad.event.ReturnEvent;
import org.apache.myfaces.trinidad.component.UIXOutput;

public class PasswordRetrDialogBean {
    
    private UIXOutput _output;
    
    /** Creates a new instance of PasswordRetrDialogBean */
    public PasswordRetrDialogBean() {
        setOutput(null);
    }
    
    public UIXOutput getOutput() {
        return _output;
    }

    public void setOutput(UIXOutput output) {
        _output = output;
    }
    
    public void returned(ReturnEvent event)
    {
        if (event.getReturnValue() != null)
        {
            getOutput().setRendered((boolean)true);
            getOutput().setValue(event.getReturnValue());
        }
    }    
}

faces-managed-beans.xml:
  <managed-bean>
      <managed-bean-name>passwordRetr</managed-bean-name>
 
<managed-bean-class>com.navisite.view.beans.PasswordRetrBean</managed-be
an-class>
      <managed-bean-scope>request</managed-bean-scope>
  </managed-bean>
  <managed-bean>
      <managed-bean-name>passwordRetrDialog</managed-bean-name>
 
<managed-bean-class>com.navisite.view.beans.PasswordRetrDialogBean</mana
ged-bean-class>
      <managed-bean-scope>request</managed-bean-scope>
  </managed-bean>

faces-navigation.xml:
    <navigation-rule>
        <from-view-id>/jsp/registration/loginJSF.jsp</from-view-id>
        <navigation-case>
            <from-outcome>login</from-outcome>
 
<to-view-id>/jsp/registration/personalInfoJSF.jsp</to-view-id>
        </navigation-case>
        <navigation-case>
            <from-outcome>dialog:passwordRetr</from-outcome>
 
<to-view-id>/jsp/registration/passwordRetrJSF.jsp</to-view-id>
        </navigation-case>
    </navigation-rule>

This e-mail is the property of NaviSite, Inc. It is intended only
for the person or entity to which it is addressed and may contain
information that is privileged, confidential, or otherwise protected
from disclosure. Distribution or copying of this e-mail, or the
information contained herein, to anyone other than the intended
recipient is prohibited.

This e-mail is the property of NaviSite, Inc. It is intended only
for the person or entity to which it is addressed and may contain
information that is privileged, confidential, or otherwise protected
from disclosure. Distribution or copying of this e-mail, or the
information contained herein, to anyone other than the intended
recipient is prohibited.

This e-mail is the property of NaviSite, Inc. It is intended only
for the person or entity to which it is addressed and may contain
information that is privileged, confidential, or otherwise protected
from disclosure. Distribution or copying of this e-mail, or the
information contained herein, to anyone other than the intended
recipient is prohibited.

Mime
View raw message