You need to pass a reference for page 1 to page 2 and then instead of
using a pagelink on page2 to return to page1 use a regular link which
sets the responsepage to the instance of page 1 you passed to page 2.
Maurice
On 6/26/07, Leucht, Axel <[EMAIL PROTECTED]> wrote:
> Sorry if this is a dumb question and has been answered hundred times but I
> couldn't find any answer to the following question.
>
> I do have two HTML pages. Page one contains a link which displays the number
> on clicks the user executed. The second link jumps to page 2. Page 2 just
> displays a link to go back to page 1.
>
> Assume that user clicks 5 times on the ClickCounter link in page 1 and hence
> the link displays as 'This link is clicked 5 times'. When the user the
> switches to page 2 and immediately goes back to page 1 the counter is reset
> to 0 and rendered as 'This link is clicked 0 times'.
>
> What am I doing wrong here? I assumed that clicking on the return-button on
> page 2 goes "back" to the original session in page 1 ?!
>
> Here is my Java classes:
> -- page 1 ---
> public class HelloWorld extends WebPage implements Serializable {
> public HelloWorld() {
> add(new Label("message", "Foo World!"));
> add(new PageLink("start", Foo.class));
> final ClickCount count1 = new ClickCount();
> Link link1 = new Link("link1") {
> public void onClick() {
> count1.clicks++;
> }
> };
> link1.add(new Label("label1", new Model() {
> public java.lang.Object getObject(Component
> component) {
> return Integer.toString(count1.clicks);
> }
> }));
> add(link1);
> }
>
> class ClickCount implements Serializable {
> private int clicks = 0;
> }
> }
> --- page 2 ---
> public class Foo extends WebPage {
> public Foo() {
> add(new Label("message", "Foo page"));
> Link pl = new PageLink("return", HelloWorld.class);
> pl.add(new AttributeAppender("class", new Model("return"), "
> "));
> add(pl);
> }
> }
> /Axel
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user