You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Artur W." <a_...@gazeta.pl> on 2007/08/11 20:53:03 UTC
shopping cart and back button
Hi!
I have a user case like this:
1. User opens products page.
2. User chooses a product.
3. User clicks "add product to shopping cart".
4. User is redirected to shopping cart list.
5. User clicks _back button in the browser_.
6. Added product in step 3 disappear from the shopping cart :(
How can I fix it?
Thanks,
Artur
--
View this message in context: http://www.nabble.com/shopping-cart-and-back-button-tf4254382.html#a12108062
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: shopping cart and back button
Posted by Eelco Hillenius <ee...@gmail.com>.
> I have a user case like this:
>
> 1. User opens products page.
> 2. User chooses a product.
> 3. User clicks "add product to shopping cart".
> 4. User is redirected to shopping cart list.
> 5. User clicks _back button in the browser_.
> 6. Added product in step 3 disappear from the shopping cart :(
So is the problem that the item is removed from the list again, or
that you display an old page?
> How can I fix it?
If the item is actually removed from the list: make sure the addition
isn't recorded as a state change (I think it only is when you call
setModelObject). Turning versioning off for the page that does the
adding (override isVersioned and let it return false) is another way
to avoid this, and in fact 'turn off' the back button for that page
altogether (because no different versions are generated te URL stays
stable).
Eelco
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: shopping cart and back button
Posted by "Artur W." <a_...@gazeta.pl>.
>Shopping cart is not supposed to be page scoped, so you need to keep
>it in session. Also if you want page to be refreshed on back button,
>you need to send the Cache-Control: no-store http header.
Thanks for pointing the difference. It explains everything! :)
Artur
--
View this message in context: http://www.nabble.com/shopping-cart-and-back-button-tf4254382.html#a12128077
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: shopping cart and back button
Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
A twist on this could be to just pass the cart around in constructors...
We've done something like that, just not with a real "cart" but a filter
for reporting.
regards Nino
Scott Swank wrote:
> I agree, having just helped implement an application with a shopping
> cart in Wicket. The cart is really an attribute of the session rather
> than of a particular page.
>
> Scott
>
>
> On 8/12/07, Matej Knopp <ma...@gmail.com> wrote:
>
>> Shopping cart is not supposed to be page scoped, so you need to keep
>> it in session. Also if you want page to be refreshed on back button,
>> you need to send the Cache-Control: no-store http header.
>>
>> -Matej
>>
>> On 8/12/07, Artur W. <a_...@gazeta.pl> wrote:
>>
>>>>> 1. User opens products page.
>>>>> 2. User chooses a product.
>>>>> 3. User clicks "add product to shopping cart".
>>>>> 4. User is redirected to shopping cart list.
>>>>> 5. User clicks _back button in the browser_.
>>>>> 6. Added product in step 3 disappear from the shopping cart :(
>>>>>
>>>> Also note that the user will always be shown the empty shopping cart
>>>> when pressing the backbutton: the page is in the browser cache. Go to
>>>> amazon and check yourself.
>>>>
>>> I don't know how about amazon but in our current implementation of the
>>> e-shop (spring+jsp)
>>> when user clicks back button the page is refreshed correctly (the added
>>> product is in the cart).
>>> Yes, we set headers :)
>>>
>>> In default wicket settings not only the shopping cart is empty but the
>>> product
>>> is removed from the cart because of backing previous model state.
>>>
>>> So the question is what is the best practice to control which state we want
>>> to versioning and which not? Could the state be partially versionable?
>>>
>>> Thanks,
>>> Artur
>>> --
>>> View this message in context: http://www.nabble.com/shopping-cart-and-back-button-tf4254382.html#a12116192
>>> 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: shopping cart and back button
Posted by Scott Swank <sc...@gmail.com>.
I agree, having just helped implement an application with a shopping
cart in Wicket. The cart is really an attribute of the session rather
than of a particular page.
Scott
On 8/12/07, Matej Knopp <ma...@gmail.com> wrote:
> Shopping cart is not supposed to be page scoped, so you need to keep
> it in session. Also if you want page to be refreshed on back button,
> you need to send the Cache-Control: no-store http header.
>
> -Matej
>
> On 8/12/07, Artur W. <a_...@gazeta.pl> wrote:
> >
> > >> 1. User opens products page.
> > >> 2. User chooses a product.
> > >> 3. User clicks "add product to shopping cart".
> > >> 4. User is redirected to shopping cart list.
> > >> 5. User clicks _back button in the browser_.
> > >> 6. Added product in step 3 disappear from the shopping cart :(
> >
> > >Also note that the user will always be shown the empty shopping cart
> > >when pressing the backbutton: the page is in the browser cache. Go to
> > >amazon and check yourself.
> >
> > I don't know how about amazon but in our current implementation of the
> > e-shop (spring+jsp)
> > when user clicks back button the page is refreshed correctly (the added
> > product is in the cart).
> > Yes, we set headers :)
> >
> > In default wicket settings not only the shopping cart is empty but the
> > product
> > is removed from the cart because of backing previous model state.
> >
> > So the question is what is the best practice to control which state we want
> > to versioning and which not? Could the state be partially versionable?
> >
> > Thanks,
> > Artur
> > --
> > View this message in context: http://www.nabble.com/shopping-cart-and-back-button-tf4254382.html#a12116192
> > 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
>
>
--
Scott Swank
reformed mathematician
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: shopping cart and back button
Posted by Matej Knopp <ma...@gmail.com>.
Shopping cart is not supposed to be page scoped, so you need to keep
it in session. Also if you want page to be refreshed on back button,
you need to send the Cache-Control: no-store http header.
-Matej
On 8/12/07, Artur W. <a_...@gazeta.pl> wrote:
>
> >> 1. User opens products page.
> >> 2. User chooses a product.
> >> 3. User clicks "add product to shopping cart".
> >> 4. User is redirected to shopping cart list.
> >> 5. User clicks _back button in the browser_.
> >> 6. Added product in step 3 disappear from the shopping cart :(
>
> >Also note that the user will always be shown the empty shopping cart
> >when pressing the backbutton: the page is in the browser cache. Go to
> >amazon and check yourself.
>
> I don't know how about amazon but in our current implementation of the
> e-shop (spring+jsp)
> when user clicks back button the page is refreshed correctly (the added
> product is in the cart).
> Yes, we set headers :)
>
> In default wicket settings not only the shopping cart is empty but the
> product
> is removed from the cart because of backing previous model state.
>
> So the question is what is the best practice to control which state we want
> to versioning and which not? Could the state be partially versionable?
>
> Thanks,
> Artur
> --
> View this message in context: http://www.nabble.com/shopping-cart-and-back-button-tf4254382.html#a12116192
> 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: shopping cart and back button
Posted by "Artur W." <a_...@gazeta.pl>.
>> 1. User opens products page.
>> 2. User chooses a product.
>> 3. User clicks "add product to shopping cart".
>> 4. User is redirected to shopping cart list.
>> 5. User clicks _back button in the browser_.
>> 6. Added product in step 3 disappear from the shopping cart :(
>Also note that the user will always be shown the empty shopping cart
>when pressing the backbutton: the page is in the browser cache. Go to
>amazon and check yourself.
I don't know how about amazon but in our current implementation of the
e-shop (spring+jsp)
when user clicks back button the page is refreshed correctly (the added
product is in the cart).
Yes, we set headers :)
In default wicket settings not only the shopping cart is empty but the
product
is removed from the cart because of backing previous model state.
So the question is what is the best practice to control which state we want
to versioning and which not? Could the state be partially versionable?
Thanks,
Artur
--
View this message in context: http://www.nabble.com/shopping-cart-and-back-button-tf4254382.html#a12116192
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: shopping cart and back button
Posted by Martijn Dashorst <ma...@gmail.com>.
On 8/11/07, Artur W. <a_...@gazeta.pl> wrote:
> 1. User opens products page.
> 2. User chooses a product.
> 3. User clicks "add product to shopping cart".
> 4. User is redirected to shopping cart list.
> 5. User clicks _back button in the browser_.
> 6. Added product in step 3 disappear from the shopping cart :(
Also note that the user will always be shown the empty shopping cart
when pressing the backbutton: the page is in the browser cache. Go to
amazon and check yourself.
There are ways to circumvent the browser caching the page, by setting
response headers such as no-cache and so forth, but that largely
depends on browser support.
Martijn
--
Wicket joins the Apache Software Foundation as Apache Wicket
Apache Wicket 1.3.0-beta2 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta2/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org