You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Adam Greene <ag...@professionalopensource.ca> on 2005/08/03 05:04:42 UTC

Problem with client side persistence

I have this piece of code:

 @Persist(value="client")
 public abstract int getClientValue();
 public abstract void setClientValue(int what);
 
 public void doAdd() {
  int value = getClientValue() + 1;
  setClientValue(value);
 }

and a DirectLink on the page that calls doAdd(), the problem is that the ClientValue will go from 0 to 1 on the first click, but get stuck there.  If I click the link again and again, it will only go to 2 (1 + 1) and if I click a PageLink that basically calls the same page again, the value becomes 1.  Is there any way to get this code working with client side persistence?  Am I missing something?

Re: Problem with client side persistence

Posted by Adam Greene <ag...@iq-2000.com>.
Ok.  Here is the problem.  There is a PageLink and a DirectLink on the page. 
the DirectLink gets called and the proper value is passed in and incremented 
by 1, the encoded state for the DirectLink is correct, but the PageLink on 
the same page, when it goes to generate it's own URL somehow gets back a 
different PersistentPropertyData with the previous value in it and it 
overrides the one DirectLink created.  I'm looking deeper but can't see 
anything right off.  I've attached the files.

----- Original Message ----- 
From: "Adam Greene" <ag...@professionalopensource.ca>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Wednesday, August 03, 2005 12:04 AM
Subject: Problem with client side persistence


I have this piece of code:

 @Persist(value="client")
 public abstract int getClientValue();
 public abstract void setClientValue(int what);

 public void doAdd() {
  int value = getClientValue() + 1;
  setClientValue(value);
 }

and a DirectLink on the page that calls doAdd(), the problem is that the 
ClientValue will go from 0 to 1 on the first click, but get stuck there.  If 
I click the link again and again, it will only go to 2 (1 + 1) and if I 
click a PageLink that basically calls the same page again, the value becomes 
1.  Is there any way to get this code working with client side persistence? 
Am I missing something? 


Re: Problem with client side persistence

Posted by Adam Greene <ag...@iq-2000.com>.
I did some initial testing.  It is generating the proper QueryParameter, but 
then when it goes to actually write out the URL in the DirectLink, it uses 
the previous value, or so it seems.

----- Original Message ----- 
From: "Adam Greene" <ag...@professionalopensource.ca>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Wednesday, August 03, 2005 12:04 AM
Subject: Problem with client side persistence


I have this piece of code:

 @Persist(value="client")
 public abstract int getClientValue();
 public abstract void setClientValue(int what);

 public void doAdd() {
  int value = getClientValue() + 1;
  setClientValue(value);
 }

and a DirectLink on the page that calls doAdd(), the problem is that the 
ClientValue will go from 0 to 1 on the first click, but get stuck there.  If 
I click the link again and again, it will only go to 2 (1 + 1) and if I 
click a PageLink that basically calls the same page again, the value becomes 
1.  Is there any way to get this code working with client side persistence? 
Am I missing something? 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Problem with client side persistence

Posted by Adam Greene <ag...@iq-2000.com>.
Ok, tracked the problem to this:  The proper value is persisted by the Page 
client persister, the incorrect value comes out of the App client persister 
and overwrites the value placed in by the Page persister (as the App 
persister comes last).

----- Original Message ----- 
From: "Adam Greene" <ag...@professionalopensource.ca>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Wednesday, August 03, 2005 12:04 AM
Subject: Problem with client side persistence


I have this piece of code:

 @Persist(value="client")
 public abstract int getClientValue();
 public abstract void setClientValue(int what);

 public void doAdd() {
  int value = getClientValue() + 1;
  setClientValue(value);
 }

and a DirectLink on the page that calls doAdd(), the problem is that the 
ClientValue will go from 0 to 1 on the first click, but get stuck there.  If 
I click the link again and again, it will only go to 2 (1 + 1) and if I 
click a PageLink that basically calls the same page again, the value becomes 
1.  Is there any way to get this code working with client side persistence? 
Am I missing something? 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org