Hi,
This started out as a question on the Tacos list, but it seems like the
real issue for me is related to page injection, property setting, and
session persistence.
The problem that I am facing is that properties that are annotated as
@Persist do not seem to actually be persisting in the session when they
are set by another page (using page injection).
For example, I have a ContactList page that uses injection to retrieve a
ContactEdit page -- and sets a Contact property on the ContactEdit page:
public abstract class ContactList extends BasePage {
public IPage doAddContact()
{
ContactEdit page = getContactEdit();
Contact contact = new Contact();
page.setContact(contact);
return page;
}
@InjectPage("ContactEdit")
public abstract ContactEdit getContactEdit();
/* ... */
}
In my ContactEdit page I have annotated that the contact property is
persistent:
public abstract class ContactEdit extends BasePage {
/* ... */
@Persist(value="session")
public abstract Contact getContact();
public abstract void setContact(Contact c);
}
Indeed, when the ContactEdit.html template loads, I can access 'contact'
property in the template and it does appear to be set to the (not NULL)
value set by ContactList.doAddContact(). However, when I subsequently
invoke a listener method on the ContactEdit page (e.g. through
tacos:AjaxDirectLink) then the getContact() method returns null --
indicating, apparently, that the 'contact' property was not actually
persistent.
At that point, if I set the property (calling setContact()) to a
non-NULL value from a ContactEdit listener method, then getContact()
calls from subsequent listener methods (i.e. if I click the
AjaxDirectLink again) will return the not-NULL object -- so it does
appear to be correctly persisting once it is set from within the
ContactEdit page.
Is this something I'm misunderstanding about how property persistence
works -- especially related to invoking a page by @InjectPage?
I hope this example made sense; I'd be happy to try to rephrase or
simplify it if it doesn't. Thanks in advance for any tips -
Hans
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]