You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Steve Swinsburg <s....@lancaster.ac.uk> on 2009/04/01 16:11:07 UTC

Constructor not being called when Back button clicked

Hi all,

I have a Page and on that page a Form which submits via Ajax.

In this page's constructor I added a debug statement that prints a  
message when the constructor is called (for testing). I then submit  
the form, click away, then click Back and in Safari 4 for Mac, the  
page is reconstructed and I see my message again (good). Everything  
works ok (also good).

However, in Firefox for Mac (and for PC and all IE flavours), clicking  
Back has the original search text in the box, and the page is NOT  
reconstructed. Clicking search again throws NPE's because certain  
elements are not initialised properly.

Is there some way to force the page to be reconstructed? Is this some  
caching issue that is causing it to be not reconstructed and hence  
just reused?


thanks,
Steve









Re: Constructor not being called when Back button clicked

Posted by Steve Swinsburg <s....@lancaster.ac.uk>.
Yup, got that in but the problem still exists, the constructor is not  
being called when the browser goes back to that page. It *could* be  
because my Wicket app is running in an iframe (sucks, but unavoidable)  
so the request params are being screwed up and Wicket is not  
initialising the page properly. Still all works fine in Safari4  
though. Odd.

Thanks for the replies.



On 1 Apr 2009, at 17:03, Mathias P.W Nilsson wrote:

>
> Like matej says
>
> @Override
> protected void setHeaders(WebResponse response) {
>           response.setHeader("Pragma", "no-cache");
>          response.setHeader("Cache-Control", "no-cache, max-age=0,
> must-revalidate, no-store");
>
>   }
> -- 
> View this message in context: http://www.nabble.com/Constructor-not-being-called-when-Back-button-clicked-tp22827398p22829529.html
> 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: Constructor not being called when Back button clicked

Posted by "Mathias P.W Nilsson" <ma...@snyltarna.se>.
Like matej says

@Override
protected void setHeaders(WebResponse response) { 
           response.setHeader("Pragma", "no-cache"); 
          response.setHeader("Cache-Control", "no-cache, max-age=0,
must-revalidate, no-store"); 

   } 
-- 
View this message in context: http://www.nabble.com/Constructor-not-being-called-when-Back-button-clicked-tp22827398p22829529.html
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: Constructor not being called when Back button clicked

Posted by Matej Knopp <ma...@gmail.com>.
You need to add Cache-control: no-store header to prevent firefox from
caching the page on back button. Look at

WebPage#setHeaders(WebResponse response)

-Matej

On Wed, Apr 1, 2009 at 5:15 PM, Timm Helbig <ti...@th-hosting.net> wrote:
>> Is there some way to force the page to be reconstructed?
> Don't use Ajax, use the default Button insteand
>
> Regards,
> Timm
>
> Am Mittwoch, 1. April 2009 16:11:07 schrieb Steve Swinsburg:
>> Hi all,
>>
>> I have a Page and on that page a Form which submits via Ajax.
>>
>> In this page's constructor I added a debug statement that prints a
>> message when the constructor is called (for testing). I then submit
>> the form, click away, then click Back and in Safari 4 for Mac, the
>> page is reconstructed and I see my message again (good). Everything
>> works ok (also good).
>>
>> However, in Firefox for Mac (and for PC and all IE flavours), clicking
>> Back has the original search text in the box, and the page is NOT
>> reconstructed. Clicking search again throws NPE's because certain
>> elements are not initialised properly.
>>
>> Is there some way to force the page to be reconstructed? Is this some
>> caching issue that is causing it to be not reconstructed and hence
>> just reused?
>>
>>
>> thanks,
>> Steve
>
>
>
> ---------------------------------------------------------------------
> 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: Constructor not being called when Back button clicked

Posted by Timm Helbig <ti...@th-hosting.net>.
> Is there some way to force the page to be reconstructed? 
Don't use Ajax, use the default Button insteand

Regards,
Timm

Am Mittwoch, 1. April 2009 16:11:07 schrieb Steve Swinsburg:
> Hi all,
>
> I have a Page and on that page a Form which submits via Ajax.
>
> In this page's constructor I added a debug statement that prints a
> message when the constructor is called (for testing). I then submit
> the form, click away, then click Back and in Safari 4 for Mac, the
> page is reconstructed and I see my message again (good). Everything
> works ok (also good).
>
> However, in Firefox for Mac (and for PC and all IE flavours), clicking
> Back has the original search text in the box, and the page is NOT
> reconstructed. Clicking search again throws NPE's because certain
> elements are not initialised properly.
>
> Is there some way to force the page to be reconstructed? Is this some
> caching issue that is causing it to be not reconstructed and hence
> just reused?
>
>
> thanks,
> Steve



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