We use a persistant page property (the db id) and then load in pageBeginRender
which makes it a little easier to deal with validation errors and create or edit
objects using the same page.
Cheers,
Geoff
public abstract Long getCompanyId();
public abstract Company getCompany();
public abstract void setCompany(Company personOne);
...
public void pageBeginRender(PageEvent event) {
// could be editing an existing company.
if (getCompanyId() != null) loadCompany();
// or rendering the page for a new company
if (getCompany() == null) {
setCompany(new Company());
setWorkPhone(getNewWorkPhone());
setFaxPhone(getNewFaxPhone());
setPhysicalAddress(getContactsUtil().getNewPhysicalAddress());
setPostalAddress(getContactsUtil().getNewPostalAddress());
}
}
private void loadCompany() {
Company company = getContactsUtil().findCompanyById(getCompanyId());
setCompany(company);
...
}
>Pat,
>Where do you intercept that value?
>
>
>----Original Message-----
>From: Patrick Casey [mailto:[EMAIL PROTECTED]
>Sent: Thu 8/18/2005 10:37 AM
>To: 'Tapestry users'
>Subject: RE: How to edit different data with one page (basically multiple
>"instances" of one page) ?
>
>
> You're going to need to do your own persistence strategy. The
>simplest solution is just to put the unique key of each invoice in the edit
>form as a hidden field. If you put it on *top* of the form, then it is set
>first during the rewind and you can use its being set as a trigger to
>bootstrap the rest of the invoice out of persistent storage.
>
> --- Pat
>
> -----Original Message-----
> From: Petr Sakar [mailto:[EMAIL PROTECTED]
> Sent: Thursday, August 18, 2005 9:13 AM
> To: [email protected]
> Subject: How to edit different data with one page (basically multiple
> "instances" of one page) ?
>
> Hello list,
> newbie question:
>
> I have a page with form to edits some data (eg. invoce1). How shall I do
> it to be able to use the same page to edit different data (eg. invoice2)
> at the same time, so I can edit both invoices simultanously ?
>
> In different words user has two windows opened and works with both, both
> windows are displaying the same page, just displayed data are diffferent
> instance(record) of some class(table). Data are kept in session for
> example as invoice1, invoice2.
>
> Thanx for any ideas.
>
> saki
>
> ---------------------------------------------------------------------
> 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]