You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by wicket user <wi...@comley.org> on 2007/09/06 10:12:32 UTC

Page state, undo and versioning?

Hi,

My scenario is the following, I've got a page that allows a user to send an
sms to themselves every 20 seconds to a maximum of two times just incase
something in the network stopped the sms from getting to them in the first
place.

I have an ajax timer that enables the resend button after the specified time
and a count property of the page that stores the number of retries.

All works well and the button is disabled and enabled as expected in the
normal flow of events.

BUT when the user hits the back button after everything has been disabled
it's all enabled again, it's clearly to do with the undo ability of wicket
but no matter what I try I can't seemed to keep those components disabled on
an undo.

I've tried:

- setting the page to versioned/unversioned
- checking the page state onBeforeRendering and trying to set the value

What's really missing in my mind is a fundemental UNDERSTANDING of how this
works and how I deal with this problem. It seems such as simple thing but
I'm more then a little confused and starting to get irked.

So my questions (plural) are the following:
- where can I read more about what happens when the back button is hit?
- is there a way I can TEST this scenario with WicketTester?
- how do I keep that page in the same state on back being hit
- Maybe I'm tackling this the wrong way and I should be storing the state in
a session?

Thanks as always
Simon

ps. Wicket rocks, it's just my understanding that doesn't

Re: Page state, undo and versioning?

Posted by Gwyn Evans <gw...@gmail.com>.
On Thursday, September 6, 2007, 9:12:32 AM, wicket <wi...@comley.org> wrote:

> My scenario is the following, I've got a page that allows a user to send an
> sms to themselves every 20 seconds to a maximum of two times just incase
> something in the network stopped the sms from getting to them in the first
> place.

[Offtopic] Does that actually work, as my expectation/experience would
suggest that you'll either get two SMs or none?

/Gwyn


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Page state, undo and versioning?

Posted by Matej Knopp <ma...@gmail.com>.
Sometimes that's only thing you can do. Because of AJAX. As the
browsers cache wrong state of DOM - so the back button doesn't work at
all.

-Matej

On 9/10/07, Johan Compagner <jc...@gmail.com> wrote:
> and that shouldn't be done because then backbutton or what ever you do will
> always
> request the page again, that would fix our back button problem even more :)
> but thats
> a horrible user experience
>
> johan
>
>
> On 9/10/07, Matej Knopp <ma...@gmail.com> wrote:
> >
> > It doesn't set the no-store flag.
> >
> >         protected void configureResponse()
> >         {
> >                 super.configureResponse();
> >
> >                 if (getWebRequestCycle().getResponse() instanceof
> > WebResponse)
> >                 {
> >                         final WebResponse response =
> > getWebRequestCycle().getWebResponse();
> >                         response.setHeader("Pragma", "no-cache");
> >                         response.setHeader("Cache-Control", "no-cache,
> > max-age=0,
> > must-revalidate"); // no-store is not set here
> >                 }
> >         }
> >
> > -Matej
> >
> > On 9/10/07, Doug Leeper <do...@yahoo.com> wrote:
> > >
> > >
> > >
> > > Matej Knopp-2 wrote:
> > > >
> > > > What Wicket version are you using? Because for reliable versioning you
> > > > will need 1.3. Also you problem can be browser caching the initial DOM
> > > > tree (not the modified one). So you should force browser to fire http
> > > > request on back button too - adding CacheControl: no-store to other
> > > > CacheControl flags in Page.configureResponse. Also this might not work
> > > > in Opera, as the browser is quite stubborn and tends to cache things
> > > > anyway.
> > > >
> > > > -Matej
> > > >
> > > >
> > >
> > > I thought the cache control flags that you have indicated should already
> > be
> > > called/set if the page in question is a WebPage (see
> > > WebPage.configureResponse() )
> > >
> > > Do I need to do anything to ensure that this method is called?
> > >
> > > - Doug
> > > --
> > > View this message in context:
> > http://www.nabble.com/Page-state%2C-undo-and-versioning--tf4390362.html#a12603266
> > > Sent from the Wicket - User mailing list archive at Nabble.com.
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Page state, undo and versioning?

Posted by Johan Compagner <jc...@gmail.com>.
and that shouldn't be done because then backbutton or what ever you do will
always
request the page again, that would fix our back button problem even more :)
but thats
a horrible user experience

johan


On 9/10/07, Matej Knopp <ma...@gmail.com> wrote:
>
> It doesn't set the no-store flag.
>
>         protected void configureResponse()
>         {
>                 super.configureResponse();
>
>                 if (getWebRequestCycle().getResponse() instanceof
> WebResponse)
>                 {
>                         final WebResponse response =
> getWebRequestCycle().getWebResponse();
>                         response.setHeader("Pragma", "no-cache");
>                         response.setHeader("Cache-Control", "no-cache,
> max-age=0,
> must-revalidate"); // no-store is not set here
>                 }
>         }
>
> -Matej
>
> On 9/10/07, Doug Leeper <do...@yahoo.com> wrote:
> >
> >
> >
> > Matej Knopp-2 wrote:
> > >
> > > What Wicket version are you using? Because for reliable versioning you
> > > will need 1.3. Also you problem can be browser caching the initial DOM
> > > tree (not the modified one). So you should force browser to fire http
> > > request on back button too - adding CacheControl: no-store to other
> > > CacheControl flags in Page.configureResponse. Also this might not work
> > > in Opera, as the browser is quite stubborn and tends to cache things
> > > anyway.
> > >
> > > -Matej
> > >
> > >
> >
> > I thought the cache control flags that you have indicated should already
> be
> > called/set if the page in question is a WebPage (see
> > WebPage.configureResponse() )
> >
> > Do I need to do anything to ensure that this method is called?
> >
> > - Doug
> > --
> > View this message in context:
> http://www.nabble.com/Page-state%2C-undo-and-versioning--tf4390362.html#a12603266
> > Sent from the Wicket - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Page state, undo and versioning?

Posted by Matej Knopp <ma...@gmail.com>.
It doesn't set the no-store flag.

	protected void configureResponse()
	{
		super.configureResponse();

		if (getWebRequestCycle().getResponse() instanceof WebResponse)
		{
			final WebResponse response = getWebRequestCycle().getWebResponse();
			response.setHeader("Pragma", "no-cache");
			response.setHeader("Cache-Control", "no-cache, max-age=0,
must-revalidate"); // no-store is not set here
		}
	}

-Matej

On 9/10/07, Doug Leeper <do...@yahoo.com> wrote:
>
>
>
> Matej Knopp-2 wrote:
> >
> > What Wicket version are you using? Because for reliable versioning you
> > will need 1.3. Also you problem can be browser caching the initial DOM
> > tree (not the modified one). So you should force browser to fire http
> > request on back button too - adding CacheControl: no-store to other
> > CacheControl flags in Page.configureResponse. Also this might not work
> > in Opera, as the browser is quite stubborn and tends to cache things
> > anyway.
> >
> > -Matej
> >
> >
>
> I thought the cache control flags that you have indicated should already be
> called/set if the page in question is a WebPage (see
> WebPage.configureResponse() )
>
> Do I need to do anything to ensure that this method is called?
>
> - Doug
> --
> View this message in context: http://www.nabble.com/Page-state%2C-undo-and-versioning--tf4390362.html#a12603266
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Page state, undo and versioning?

Posted by Doug Leeper <do...@yahoo.com>.


Matej Knopp-2 wrote:
> 
> What Wicket version are you using? Because for reliable versioning you
> will need 1.3. Also you problem can be browser caching the initial DOM
> tree (not the modified one). So you should force browser to fire http
> request on back button too - adding CacheControl: no-store to other
> CacheControl flags in Page.configureResponse. Also this might not work
> in Opera, as the browser is quite stubborn and tends to cache things
> anyway.
> 
> -Matej
> 
> 

I thought the cache control flags that you have indicated should already be
called/set if the page in question is a WebPage (see
WebPage.configureResponse() )

Do I need to do anything to ensure that this method is called?

- Doug
-- 
View this message in context: http://www.nabble.com/Page-state%2C-undo-and-versioning--tf4390362.html#a12603266
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Page state, undo and versioning?

Posted by Matej Knopp <ma...@gmail.com>.
What Wicket version are you using? Because for reliable versioning you
will need 1.3. Also you problem can be browser caching the initial DOM
tree (not the modified one). So you should force browser to fire http
request on back button too - adding CacheControl: no-store to other
CacheControl flags in Page.configureResponse. Also this might not work
in Opera, as the browser is quite stubborn and tends to cache things
anyway.

-Matej

On 9/6/07, wicket user <wi...@comley.org> wrote:
> Hi,
>
> My scenario is the following, I've got a page that allows a user to send an
> sms to themselves every 20 seconds to a maximum of two times just incase
> something in the network stopped the sms from getting to them in the first
> place.
>
> I have an ajax timer that enables the resend button after the specified time
> and a count property of the page that stores the number of retries.
>
> All works well and the button is disabled and enabled as expected in the
> normal flow of events.
>
> BUT when the user hits the back button after everything has been disabled
> it's all enabled again, it's clearly to do with the undo ability of wicket
> but no matter what I try I can't seemed to keep those components disabled on
> an undo.
>
> I've tried:
>
> - setting the page to versioned/unversioned
> - checking the page state onBeforeRendering and trying to set the value
>
> What's really missing in my mind is a fundemental UNDERSTANDING of how this
> works and how I deal with this problem. It seems such as simple thing but
> I'm more then a little confused and starting to get irked.
>
> So my questions (plural) are the following:
> - where can I read more about what happens when the back button is hit?
> - is there a way I can TEST this scenario with WicketTester?
> - how do I keep that page in the same state on back being hit
> - Maybe I'm tackling this the wrong way and I should be storing the state in
> a session?
>
> Thanks as always
> Simon
>
> ps. Wicket rocks, it's just my understanding that doesn't
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org