You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-user@incubator.apache.org by Adam Winer <aw...@gmail.com> on 2007/03/01 03:30:25 UTC
Re: Must refresh page to get returnListener value from dialogs
All you need to do is redo that outputText:
<tr:outputText value=""
binding="#{passwordRetrDialog.output}"
rendered="false"/>
to
<tr:outputText
binding="#{passwordRetrDialog.output}"
partialTriggers="buddonId"/>
... and remove the code that calls setRendered() from your
return listener.
Three things to know:
(1) returnListeners always come with partial-page rendering
(2) Setting partialTriggers will repaint the outputText when that
commandLInk fires.
(3) Partial-page rendering cannot deal with changes to "rendered",
at least not on the top component that is being re-rendered.
So in a situation like this, either leave it rendered all the time
(which will work fine here), or put partialTriggers on the parent.
-- Adam
On 2/26/07, Causevic, Dzenan <dc...@navisite.com> wrote:
> Where exactly is that email message?
> Maybe I missed some details
>
>
>
> _______________________________
> Dzenan Causevic
> Web Applications Developer
> NaviSite, Inc.
> 315-453-2912 x5346 (Office)
> 315-278-7371 (Cell)
> www.NaviSite.com
>
>
> -----Original Message-----
> From: Adam Winer [mailto:awiner@gmail.com]
> Sent: Friday, February 23, 2007 8:45 PM
> To: adffaces-user@incubator.apache.org
> Subject: Re: Must refresh page to get returnListener value from dialogs
>
> On 2/22/07, Causevic, Dzenan <dc...@navisite.com> wrote:
> > Anybody any idea why I have to do hard refresh in order for page to
> > display the values?
>
> Yes - I think I explained that in my e-mail message.
> You need to use partialTriggers (part of partial-page
> rendering) to tell Trinidad what to redraw when
> the return happens.
>
> -- Adam
>
> >
> > 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.
>