You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Alex Rass <ar...@itbsllc.com> on 2010/08/06 13:44:03 UTC
back link
Hi.
Here's a "cooky-wacky" problem:
Added this to my markup:
<a href="#" onClick="history.go(-1)" class="backbutton">Back</a>
But when I am running this under the wicket (w/ FFox), it works great once.
Then it starts jumping me back to this page after I leave it.
Is there something I should be doing differently to create a back button? :)
I know this is an HTML/JS question, but this is a typical thing to do in
HTML and it usually works, afaik.
- Alex
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: RE: back link
Posted by Leszek Gawron <lg...@gmail.com>.
Well ... first off the code was written out the top of my head and as it is
totally trivial there should be no problem there is a typo somewhere.
Answering your second concern: no it shouldn't be built-in in:
- it breaks pages' statelessness
- the web navigation is hardly ever linear so you always need to tweak it
for your needs.
- when you put ajax info the picture you need to come up with another
approach.
Cheers
W dniu 2010-08-09 02:33 użytkownik "Alex Rass" <ar...@itbsllc.com> napisał:
Well, first off, there's a bug:
> setResponsePage( new TargetPage( new SomeModel(),
> Originatin...
Needs to be part of constructor call:
> setResponsePage( new TargetPage( new SomeModel(),
> OriginatingPage.this ) );
Second of all: this seems so "dirty".
Doing this means that for something THIS simple and common, you need to go
and change ALL your page's constructors?
Yes, I can go through the types of Pages and inherit them all once and add
all features I need into them, but it also seems like it's something that
should be inherent/built in, no?
- Alex
>-----Original Message-----
>From: Leszek Gawron [mailto:lgawron@gmail.com] On Behalf Of Leszek
Gaw...
RE: back link
Posted by Alex Rass <ar...@itbsllc.com>.
Well, first off, there's a bug:
> setResponsePage( new TargetPage( new SomeModel(),
> OriginatingPage.this );
Needs to be part of constructor call:
> setResponsePage( new TargetPage( new SomeModel(),
> OriginatingPage.this ) );
Second of all: this seems so "dirty".
Doing this means that for something THIS simple and common, you need to go
and change ALL your page's constructors?
Yes, I can go through the types of Pages and inherit them all once and add
all features I need into them, but it also seems like it's something that
should be inherent/built in, no?
- Alex
>-----Original Message-----
>From: Leszek Gawron [mailto:lgawron@gmail.com] On Behalf Of Leszek
Gawron
>Sent: Friday, 6 August 2010 10:22 PM
>To: users@wicket.apache.org
>Subject: Re: back link
>
>You are better of with something like this :
>
>public class OriginatingPage extends WebPage {
> public OriginatingPage() {
> add( new Link( "targetPage" ) {
> public void onClick() {
> setResponsePage( new TargetPage( new SomeModel(),
> OriginatingPage.this );
> }
> }
> }
>}
>
>
>public class TargetPage extends WebPage {
> public TargetPage( IModel<?> model, final Page returnPage ) {
> super( model );
> add( new Link( "back" ) {
> public void onClick() {
> setResponsePage( returnPage );
> }
> }
> }
>}
>
>
>You can use analogous technique for panel replacement.
>
>this way it always 100% predictable (and BTW works when javascript is
>not available: javascript turned off, dummy browsers on mobile
devices).
>
>--
>Leszek Gawron http://www.mobilebox.pl/krs.html
>CTO at MobileBox Ltd.
>
>---------------------------------------------------------------------
>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: back link
Posted by Leszek Gawron <lg...@gmail.com>.
On Saturday, August 7, 2010, Chris Colman <ch...@stepaheadsoftware.com> wrote:
> Does this work for clicking 'back' n times where n > 1 or does it only
> work in the n = 1 case?
Yes it does. Please mind though that the pagemap size is limited so
you might get "page expired" for large n values. I have never
experienced the problem for n values up to 10-15...
LG
--
Leszek Gawron
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
RE: back link
Posted by Chris Colman <ch...@stepaheadsoftware.com>.
Does this work for clicking 'back' n times where n > 1 or does it only
work in the n = 1 case?
>-----Original Message-----
>From: Leszek Gawron [mailto:lgawron@gmail.com] On Behalf Of Leszek
Gawron
>Sent: Friday, 6 August 2010 10:22 PM
>To: users@wicket.apache.org
>Subject: Re: back link
>
>You are better of with something like this :
>
>public class OriginatingPage extends WebPage {
> public OriginatingPage() {
> add( new Link( "targetPage" ) {
> public void onClick() {
> setResponsePage( new TargetPage( new SomeModel(),
> OriginatingPage.this );
> }
> }
> }
>}
>
>
>public class TargetPage extends WebPage {
> public TargetPage( IModel<?> model, final Page returnPage ) {
> super( model );
> add( new Link( "back" ) {
> public void onClick() {
> setResponsePage( returnPage );
> }
> }
> }
>}
>
>
>You can use analogous technique for panel replacement.
>
>this way it always 100% predictable (and BTW works when javascript is
>not available: javascript turned off, dummy browsers on mobile
devices).
>
>--
>Leszek Gawron http://www.mobilebox.pl/krs.html
>CTO at MobileBox Ltd.
>
>---------------------------------------------------------------------
>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: SV: back link
Posted by Leszek Gawron <lg...@mobilebox.pl>.
On 2010-08-06 14:29, Wilhelmsen Tor Iver wrote:
>> public TargetPage( IModel<?> model, final Page returnPage ) {
>
> You should use PageReference objects instead to avoid issues with serialization.
>
> - Tor Iver
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
AFAIU pages refered in other pages are in fact automatically serialized
as PageReferences. Am I wrong? Has the serialization magic been removed?
lg
--
Leszek Gawron http://www.mobilebox.pl/krs.html
CTO at MobileBox Ltd.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
SV: back link
Posted by Wilhelmsen Tor Iver <To...@arrive.no>.
> public TargetPage( IModel<?> model, final Page returnPage ) {
You should use PageReference objects instead to avoid issues with serialization.
- Tor Iver
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: back link
Posted by Leszek Gawron <lg...@mobilebox.pl>.
On 2010-08-06 13:44, Alex Rass wrote:
> Hi.
>
> Here's a "cooky-wacky" problem:
>
> Added this to my markup:
> <a href="#" onClick="history.go(-1)" class="backbutton">Back</a>
>
> But when I am running this under the wicket (w/ FFox), it works great once.
> Then it starts jumping me back to this page after I leave it.
>
> Is there something I should be doing differently to create a back button? :)
> I know this is an HTML/JS question, but this is a typical thing to do in
> HTML and it usually works, afaik.
this might be the typical way but probably the worst ever ...
You are better of with something like this :
public class OriginatingPage extends WebPage {
public OriginatingPage() {
add( new Link( "targetPage" ) {
public void onClick() {
setResponsePage( new TargetPage( new SomeModel(),
OriginatingPage.this );
}
}
}
}
public class TargetPage extends WebPage {
public TargetPage( IModel<?> model, final Page returnPage ) {
super( model );
add( new Link( "back" ) {
public void onClick() {
setResponsePage( returnPage );
}
}
}
}
You can use analogous technique for panel replacement.
this way it always 100% predictable (and BTW works when javascript is
not available: javascript turned off, dummy browsers on mobile devices).
--
Leszek Gawron http://www.mobilebox.pl/krs.html
CTO at MobileBox Ltd.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org