I hear you... that's the nice thing about open source though!

This would be a great enhancement! I'm currently struggling with the back 
button as well- getting an IllegalStateException("Invalid Index") in StateUtils 
> restoreKey(FacesBean.Type type, Object value). It would be nice to have more 
control on component and data restoration when the back button is clicked 
(possibly in a history listener).

-----Original Message-----
From: Adam Winer [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 14, 2007 2:09 PM
To: MyFaces Discussion
Subject: Re: [Trinidad] Page flow scope and Back button


Ah, OK.  Yeah, it'd be a great enhancement.  It hasn't
happened since we open-sourced because no one's
brought up the idea before.  Why things do or don't
happen at Oracle is another question altogether.

-- Adam


On 6/14/07, William Hoover <[EMAIL PROTECTED]> wrote:
> A back button detection/management mechanism similar to GWT HistoryListener.
>
> -----Original Message-----
> From: Adam Winer [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 14, 2007 1:35 PM
> To: MyFaces Discussion
> Subject: Re: [Trinidad] Page flow scope and Back button
>
>
> What's "this"?
>
> -- Adam
>
>
> On 6/14/07, William Hoover <[EMAIL PROTECTED]> wrote:
> > I wonder why this was not implemented in trinidad's base classes/interfaces 
> > in a generic way?
> >
> > -----Original Message-----
> > From: Adam Winer [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, June 13, 2007 9:26 PM
> > To: MyFaces Discussion
> > Subject: Re: [Trinidad] Page flow scope and Back button
> >
> >
> > On 6/13/07, D. Cardon <[EMAIL PROTECTED]> wrote:
> > > Thanks for the tip!  That makes a lot of sense to me, but I'm a little 
> > > confused about
> > > implementation.  Does it make a difference 'when' in the lifecycle I set 
> > > the variables?
> > >
> > > For example, suppose the user enters the URL for my create page: 
> > > */create.jsf
> > > Then, there will be no attributes stored on the page.  So, I create them, 
> > > but that occurs
> > > in the render response phase of the page:
> >
> > That's the problem!  It's a gotcha with page flow scope:  if you wait
> > until render response to add something, it gets dropped.  I think
> > there's a logged warning, but I'm not 100% sure of that.
> >
> > The reason for this is that we generate tokens lazily - we don't
> > want to add a pageflowscope token unless absolutely necessary -
> > but if you add it in render response, we've likely already sent the
> > postback URL down to the client.
> >
> > -- Adam
> >
> >
> > >
> > >     
> > > RequestContext.getCurrentInstance().getPageFlowScope().put("createdVar", 
> > > Boolean.FALSE);
> > >     Boolean [] createdArr = new Boolean[ 1 ];
> > >     createdArr[ 0 ] = Boolean.FALSE;
> > >     
> > > RequestContext.getCurrentInstance().getPageFlowScope().put("createdArr", 
> > > createdArr);
> > >
> > > Then, when the user presses 'save' on the page, then the save method 
> > > runs, in which I update the
> > > variables:
> > >
> > >     RequestContext context = RequestContext.getCurrentInstance();
> > >     context.getPageFlowScope().put("createdVar", Boolean.TRUE);
> > >     Boolean [] createdArr = (Boolean []) 
> > > context.getPageFlowScope().get("createdArr");
> > >     createdArr[ 0 ] = Boolean.TRUE;
> > >
> > > When I press the 'back' button, then neither of these attributes exist on 
> > > the page--it's as though
> > > the user had re-entered the page URL.
> > >
> > > So, I think I'm missing an important piece--how do I make sure the page 
> > > attributes are stored on
> > > the page to begin with?  or is there no way to do that?
> > >
> > > Thanks again for your help,
> > >
> > > --David
> > >
> > > --- Adam Winer <[EMAIL PROTECTED]> wrote:
> > >
> > > > Sure, what you do is:
> > > > - Store a token - Integer, String, enum, anything you want, that 
> > > > indicates
> > > > what page you're on, just like you're doing now.  As you know, this 
> > > > will be
> > > > restore when the back button is hit.
> > > >
> > > > - In addition to storing that token right on the pageFlowScope, also 
> > > > set it
> > > > into a one-element array on the pageFlowScope - but don't create a new 
> > > > array
> > > > each time, just keep writing into that first element.
> > > >
> > > > The one-element array will *not* be restored to its prior state, because
> > > > it's still the same instance.  Consequently, when you go back a page, 
> > > > you'll
> > > > see that the token directly on the page won't match the token within the
> > > > array.  Back button detected!
> > > >
> > > > You could encapsulate this strategy into a reusable object if desired.
> > > >
> > > > -- Adam
> > > >
> > > >
> > > >
> > > > On 6/11/07, D. Cardon <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > > Thanks, that clarifies the documentation.
> > > > >
> > > > > So, my follow-up question would be: Is there any way that I can 
> > > > > detect in
> > > > > Trinidad that the user
> > > > > has gone from one page to the next one and then back again?
> > > > >
> > > > > Thank you for your help,
> > > > >
> > > > > --David
> > > > >
> > > > > --- Adam Winer <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > > > On 6/8/07, D. Cardon <[EMAIL PROTECTED]> wrote:
> > > > > > > Hi *,
> > > > > > >
> > > > > > > I'm a little uncertain about how the pageFlowScope interacts with 
> > > > > > > the
> > > > > browser's Back button.
> > > > > > The
> > > > > > > documentation states:
> > > > > > >
> > > > > > >   "...clicking the Back button will automatically reset the page 
> > > > > > > flow
> > > > > scope to its original
> > > > > > > state."
> > > > > > >
> > > > > > > Which 'original state' is this referring to?
> > > > > > >
> > > > > > > For example, suppose I have this situation:
> > > > > > >
> > > > > > > I have a wizard application.  On the first page of the wizard, the
> > > > > user should enter a
> > > > > > username
> > > > > > > and password and then proceed to the next page of the wizard.
> > > > > > >
> > > > > > > When the first page of the wizard loads, the username and password
> > > > > fields may be entered into.
> > > > > > > The page that takes the user to the first wizard page creates a 
> > > > > > > "mode"
> > > > > variable in the page
> > > > > > flow
> > > > > > > scope and sets it to "create".
> > > > > > >
> > > > > > > After entering valid information, the user presses the "next" 
> > > > > > > button
> > > > > on the wizard.  In
> > > > > > processing
> > > > > > > the command button, the code sets the page flow scope variable 
> > > > > > > "mode"
> > > > > to "wizard".
> > > > > > >
> > > > > > > When on the second page of the wizard, the user then presses the
> > > > > "back" button.  What is the
> > > > > > value
> > > > > > > of the "mode" variable in the page flow scope? "create" or 
> > > > > > > "wizard"?
> > > > > >
> > > > > > It's "create".
> > > > > >
> > > > > > -- Adam
> > > > > >
> > > > > > >
> > > > > > > I would like to prevent the user from re-entering the username and
> > > > > password after browsing
> > > > > > "back"
> > > > > > > to the first page of the wizard.  I thought I could use the
> > > > > pageFlowScope to do that, but
> > > > > > maybe
> > > > > > > there is a better way.  Any suggestions?
> > > > > > >
> > > > > > > Thanks,
> > > > > > >
> > > > > > > --David
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > ____________________________________________________________________________________
> > > > > > > Get the free Yahoo! toolbar and rest assured with the added 
> > > > > > > security
> > > > > of spyware protection.
> > > > > > > http://new.toolbar.yahoo.com/toolbar/features/norton/index.php
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > ____________________________________________________________________________________
> > > > > Don't pick lemons.
> > > > > See all the new 2007 cars at Yahoo! Autos.
> > > > > http://autos.yahoo.com/new_cars.html
> > > > >
> > > >
> > >
> > >
> > >
> > >
> > > ____________________________________________________________________________________
> > > Yahoo! oneSearch: Finally, mobile search
> > > that gives answers, not web links.
> > > http://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC
> > >
> >
> >
>
>

Reply via email to