Is there a situation in which it makes sense to initialise a field AND annotate it with @Persist?

If not, then I'd like Tapestry to detect it and throw an exception. I've been caught out by this too and it's a huge time-waster.

Geoff

On 18/06/2008, at 4:45 AM, Dave Dombrosky wrote:

I also came across this issue.  It was very tricky to troubleshoot.

I have added a documentation bug to JIRA so that other people can
avoid this problem.  Here is the link to the issue:
https://issues.apache.org/jira/browse/TAPESTRY-2463

-Dave

On Tue, Jun 17, 2008 at 1:16 AM, Dmitry Shyshkin <[EMAIL PROTECTED]> wrote:
Hi, Thorsten

This is correct behavior. Tapestry pages are shared across all requests, so
User object will be the same. you need to add some code like follow:

@Persist
@Property
private User user;

@OnEvent(Form.PREPARE)
void prepare() {
 if (user == null) {         user = new User();
 }
}



Thorsten Castor wrote:

Hi,

we just figured out that properties which are instantiated directly will
be shared between sessions on the same server.
So if you start the example app on two browsers and type some text in the textfield of the first browser, hit enter and reload on the second browser you will see the content here as well. If the property is instantiated lazy
in a getter or any other method the content won't be shared.
I tested it with 5.0.11, 5.0.12-SNAPSHOT and 5.0.13-SNAPSHOT on
jetty-6.1.9 and tomcat-6.0.13.
I'm quite new to the list so was this problem discussed before or is it a
bug?

Here the example I used:

public class Index {
 @Persist
 @Property
 private User user = new User();
       @Component(id="textField", parameters={"value=user.name"})
 private TextField textField;
}

<html xmlns:t="http://tapestry.apache.org/schema/ tapestry_5_0_0.xsd">
 <head></head>
 <body>
     <t:form>
         <t:textfield t:id="textField"/>
     </t:form>
 </body>
</html>

public class User {
 private String name;

 public String getName() {
     return name;
 }

 public void setName(String name) {
     this.name = name;
 }
}





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to