While it seems like a good idea (and believe me I've tried) to have one page
handle create/update it turns out that many things conspire to make this
more difficult than it seems and I've just returned to having a PersonNew
and a PersonEdit.

The first problem is if you use @Persist like you are using it the Person is
persisted in the session forever. This means if you return to the PersonEdit
page and do not provide an activation context you will get the last person
created/edited. This is almost never what you want and I suspect it part of
your problem. The easiest way to solve this is don't use @Persist

So my suggestion would be something like:

public class PersonEdit {

@PageActivationContext
@Property
private Person person;

@CommitAfter
Object onSuccess() {
return Persons.class
}

and 

public class PersonNew {
@Property
private Person person;

@Inject
private Session session;

@CommitAfter
Object onSuccess() {
session.saveOrUpdate(person); 
return Persons.class
}
}

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Pagelink-above-grid-picks-up-context-from-last-pagelink-in-grid-tp5660049p5662588.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to