You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Bill Lear <ra...@zopyra.com> on 2004/02/05 01:15:39 UTC

Question on persistent page properties

I am confused about persistent page properties.

I thought a persistent page property worked like this: each time the page
is loaded, all persistent page properties for the session are "put back"
in the page for access across requests.

This seems to work for java.lang.String, but does not work for my
class (which does implement Serializable, if that matters).

Here is the page snippet:

    <property-specification
       name="pager"
       persistent="yes"
       type="com.zopyra.memoria.model.Pager"
       initial-value="new com.zopyra.memoria.model.Pager()"/>

    <property-specification
       name="fungo"
       persistent="yes"
       type="java.lang.String"
       initial-value="new java.lang.String()"/>

I declare abstract get/set methods for these items.  When the page
loads, I can get the fungo property fine.  When I set it, it stays
set, and the next time I load the page, the fungo property is set.
But, when I try this with the pager property, it seems to be creating
a new object each time.

I have a DirectLink listener that does getPager().  On subsequent
invocations, the pager object is entirely different, but not the String
fungo object.

What gives???

Thanks for any help.


Bill

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


Re: Question on persistent page properties

Posted by Bill Lear <ra...@zopyra.com>.
On Wednesday, February 4, 2004 at 17:10:30 (-0800) Paul Ferraro writes:
>Do you know that the Pager object is getting recreated, i.e. the 
>object's properties are being reset, or are you just assuming this 
>because the toString() is indicating a different object reference?  If 
>so, this would force the session to serialize between requests and cause 
>the references to be different between requests, although the object 
>should be equivalent (in a .equals() way).  If this is the case, try 
>implementing toString() so that you can inspect Pager's properties.

In a search method, the pager reports that there are 8 pages of
results just before the search method returns.  When the link is
invoked, the pager, not having been changed a jot in the interim,
shows 0 results.


Bill

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


Re: Question on persistent page properties

Posted by Paul Ferraro <pm...@columbia.edu>.
Do you know that the Pager object is getting recreated, i.e. the 
object's properties are being reset, or are you just assuming this 
because the toString() is indicating a different object reference?  If 
so, this would force the session to serialize between requests and cause 
the references to be different between requests, although the object 
should be equivalent (in a .equals() way).  If this is the case, try 
implementing toString() so that you can inspect Pager's properties.

Paul Ferraro

Bill Lear wrote:

>On Thursday, February 5, 2004 at 02:26:13 (+0200) Mindbridge writes:
>  
>
>>Hi,
>>
>>I guess Pager is mutable and you are using beta 3. Could you try with the
>>code in CVS?
>>    
>>
>
>Roger.
>
>% cvs update -d
> ...
>
>% ant
>BUILD FAILED
>file:/home/rael/dev/jakarta-tapestry/build.xml:576: Directory /usr/share/java-tap creation was not successful for an unknown reason
>
>% [change to root, make directory (!!), change ownership...]
>
>% ant
>
>... beta-4 jars made, copy to my project, clean, rebuild, deploy ...
>
>And, still the same thing:
>
>On the first click of link:
>
>     [java] nextPage(): fungo is
>     [java] nextPage(): fungo is now set to fungo
>     [java] nextPage(): pager object is com.zopyra.memoria.model.Pager@17aece8
>
>On the second click of link:
>
>     [java] nextPage(): fungo is fungo
>     [java] nextPage(): fungo is now set to fungo
>     [java] nextPage(): pager object is com.zopyra.memoria.model.Pager@1ad6b4b
>
>Gads.  What's wrong?
>
>
>Bill
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>  
>


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


Re: Question on persistent page properties

Posted by Bill Lear <ra...@zopyra.com>.
On Wednesday, February 4, 2004 at 18:43:12 (-0600) Bill Lear writes:
>On Thursday, February 5, 2004 at 02:26:13 (+0200) Mindbridge writes:
>>Hi,
>>
>>I guess Pager is mutable and you are using beta 3. Could you try with the
>>code in CVS?
>...
>And, still the same thing:
>
>On the first click of link:
>
>     [java] nextPage(): fungo is
>     [java] nextPage(): fungo is now set to fungo
>     [java] nextPage(): pager object is com.zopyra.memoria.model.Pager@17aece8
>
>On the second click of link:
>
>     [java] nextPage(): fungo is fungo
>     [java] nextPage(): fungo is now set to fungo
>     [java] nextPage(): pager object is com.zopyra.memoria.model.Pager@1ad6b4b
>
>Gads.  What's wrong?

I tried a very simple change: I wrote a Visit object, put the pager
object in the Visit, commented out the property spec, added a concrete
getter getPage() which pulls the pager out of the Visit, and now it
works perfectly.  I'm stumped.

If this is a bug introduced lately, this means a big, fat -1 on the
release of the beta in this form.


Bill

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


Re: Question on persistent page properties

Posted by Bill Lear <ra...@zopyra.com>.
On Thursday, February 5, 2004 at 02:26:13 (+0200) Mindbridge writes:
>Hi,
>
>I guess Pager is mutable and you are using beta 3. Could you try with the
>code in CVS?

Roger.

% cvs update -d
 ...

% ant
BUILD FAILED
file:/home/rael/dev/jakarta-tapestry/build.xml:576: Directory /usr/share/java-tap creation was not successful for an unknown reason

% [change to root, make directory (!!), change ownership...]

% ant

... beta-4 jars made, copy to my project, clean, rebuild, deploy ...

And, still the same thing:

On the first click of link:

     [java] nextPage(): fungo is
     [java] nextPage(): fungo is now set to fungo
     [java] nextPage(): pager object is com.zopyra.memoria.model.Pager@17aece8

On the second click of link:

     [java] nextPage(): fungo is fungo
     [java] nextPage(): fungo is now set to fungo
     [java] nextPage(): pager object is com.zopyra.memoria.model.Pager@1ad6b4b

Gads.  What's wrong?


Bill

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


Re: Question on persistent page properties

Posted by Mindbridge <mi...@yahoo.com>.
Hi,

I guess Pager is mutable and you are using beta 3. Could you try with the
code in CVS?


----- Original Message ----- 
From: "Bill Lear" <ra...@zopyra.com>
To: <ta...@jakarta.apache.org>
Sent: Thursday, February 05, 2004 2:15 AM
Subject: Question on persistent page properties


> I am confused about persistent page properties.
>
> I thought a persistent page property worked like this: each time the page
> is loaded, all persistent page properties for the session are "put back"
> in the page for access across requests.
>
> This seems to work for java.lang.String, but does not work for my
> class (which does implement Serializable, if that matters).
>
> Here is the page snippet:
>
>     <property-specification
>        name="pager"
>        persistent="yes"
>        type="com.zopyra.memoria.model.Pager"
>        initial-value="new com.zopyra.memoria.model.Pager()"/>
>
>     <property-specification
>        name="fungo"
>        persistent="yes"
>        type="java.lang.String"
>        initial-value="new java.lang.String()"/>
>
> I declare abstract get/set methods for these items.  When the page
> loads, I can get the fungo property fine.  When I set it, it stays
> set, and the next time I load the page, the fungo property is set.
> But, when I try this with the pager property, it seems to be creating
> a new object each time.
>
> I have a DirectLink listener that does getPager().  On subsequent
> invocations, the pager object is entirely different, but not the String
> fungo object.
>
> What gives???
>
> Thanks for any help.
>
>
> Bill
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


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