You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by William Keller <Wi...@news.com.au> on 2004/06/23 05:44:37 UTC
Persistent property that isn't quite persistent!
Hi all,
Again, I'm resorting to the list to figure out why I can't do some stuff
:) Not a huge issue, but it relates to a 'User' object I have created from a
WSDL (using Apache AXIS 1.0). It implements java.io.Serializable, but it
won't actually get stored as a persistent page property. My declarations in
the Register.page is like:
<property-specification name="user" persistent="yes"
type="package.xxx.User"
initial-value="new package.xxx.User()"
/>
But it never actually gets stored. Also, it gets instantiated every time I
visit the page (verified by printing a statement at the constructor). Does
anyone have any similar issues ? I've also verified that my class is
probably to blame, because I can get Strings to persist. I'd be forever
grateful if someone can help!
Signed... n00b13
Re: Persistent property that isn't quite persistent!
Posted by Geoff Longman <gl...@intelligentworks.com>.
Yes, things are persisted when they change. That means the set(PropertyName) needs to be called when a change occurs.
When the property getter/setters are soley created by Tapestry bytecode enhancement, the synthetic set(PropertyName) will only be called when an ognl expression updates the value.
If you are changing values in code (i.e. a listener method), you need to put an abstract setter in the source file so that your listener method can call the setter after making a change.
Geoff
----- Original Message -----
From: "Glen Stampoultzis" <gs...@iinet.net.au>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Wednesday, June 23, 2004 6:17 AM
Subject: Re: Persistent property that isn't quite persistent!
>
> That's an easy one. :-)
>
> Tapestry only persists things when they change. For primitive and
> immutable types this is not a problem but when you're dealing with mutable
> objects they only get persisted when the reference to the object is changed.
>
> I think it might be possible to force tapestry to persist it by firing a
> property change event (sorry I'm a bit sketchy on the details).
>
> The best thing is to mutable objects as persistent properties.
>
> Regards,
>
> Glen
>
>
> At 01:44 PM 23/06/2004, you wrote:
> >Hi all,
> > Again, I'm resorting to the list to figure out why I can't do some stuff
> >:) Not a huge issue, but it relates to a 'User' object I have created from a
> >WSDL (using Apache AXIS 1.0). It implements java.io.Serializable, but it
> >won't actually get stored as a persistent page property. My declarations in
> >the Register.page is like:
> >
> ><property-specification name="user" persistent="yes"
> >
> >type="package.xxx.User"
> >
> >initial-value="new package.xxx.User()"
> >
> >/>
> >
> >
> >
> >But it never actually gets stored. Also, it gets instantiated every time I
> >visit the page (verified by printing a statement at the constructor). Does
> >anyone have any similar issues ? I've also verified that my class is
> >probably to blame, because I can get Strings to persist. I'd be forever
> >grateful if someone can help!
> >
> >
> >
> >Signed... n00b13
>
>
> Glen Stampoultzis
> gstamp@iinet.net.au
> http://members.iinet.net.au/~gstamp/glen/
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Persistent property that isn't quite persistent!
Posted by Glen Stampoultzis <gs...@iinet.net.au>.
That's an easy one. :-)
Tapestry only persists things when they change. For primitive and
immutable types this is not a problem but when you're dealing with mutable
objects they only get persisted when the reference to the object is changed.
I think it might be possible to force tapestry to persist it by firing a
property change event (sorry I'm a bit sketchy on the details).
The best thing is to mutable objects as persistent properties.
Regards,
Glen
At 01:44 PM 23/06/2004, you wrote:
>Hi all,
> Again, I'm resorting to the list to figure out why I can't do some stuff
>:) Not a huge issue, but it relates to a 'User' object I have created from a
>WSDL (using Apache AXIS 1.0). It implements java.io.Serializable, but it
>won't actually get stored as a persistent page property. My declarations in
>the Register.page is like:
>
><property-specification name="user" persistent="yes"
>
>type="package.xxx.User"
>
>initial-value="new package.xxx.User()"
>
>/>
>
>
>
>But it never actually gets stored. Also, it gets instantiated every time I
>visit the page (verified by printing a statement at the constructor). Does
>anyone have any similar issues ? I've also verified that my class is
>probably to blame, because I can get Strings to persist. I'd be forever
>grateful if someone can help!
>
>
>
>Signed... n00b13
Glen Stampoultzis
gstamp@iinet.net.au
http://members.iinet.net.au/~gstamp/glen/