2007/12/21, Kaspar Fischer <[EMAIL PROTECTED]>: > > > On 20.12.2007, at 18:16, <[EMAIL PROTECTED]> > <[EMAIL PROTECTED]> wrote: > >> Does this mean that Tapestry will keep in its page pool an > >> IExternalPage page for each article I have in the DB (once > >> this page is visited)? > > > > Please refer to > > http://tapestry.apache.org/tapestry4.1/usersguide/state.html > > Tapestry will keep in its pool one instance for each *concurrent > > request* it is serving. Your persistent page-id will be stored in the > > session or on the client (configurable). > > When a request comes in, Tapestry will pick a page from the pool and > > provide it with the persistent property data, e.g. the reference to > > your > > db-data. > > I don't see how this solves my problem of emitting DirectLinks with > parameters into the page. If I understand you correctly, you say that > by using persisted properties, my DirectLinks do not need to contain > the page's parameters, right? > > Suppose my article page contains a link to download the article. This > link is implemented via a DirectLink. Suppose now the user opens two > tabs, > in this order: > > http://my.org/app?page=Article&id=1 > http://my.org/app?page=Article&id=2 > > After this, the session holds "id=2". Now the user clicks the download > link in the former page (id=1). As this DirectLink does not contain > "id=1" > the user will get article 2. That's not what the user expects. > > Do I misunderstand this? > > It seems to me that persistent properties do not solve the problem. I > need a way to tell DirectLink to look up the current external page's > parameter's and embed them in the link.
Sounds like what you really want is client-side persistence. This will store your page-state in the URL - or in a hidden field, if your page uses forms. So, to be concrete, if you're having a non-null property annotated with @Persist("client"), or tagged appropriately in the .page xml-File, your direct Link will, magically, render as something like: http://localhost:8080/myapp/app?component=dl&page=Home&service=direct&state:Home=BrO0ABXcQAAAAAQAACXRyaWdnZXJlZHQAATE%3D The funny String making up the value of the parameter "state:Home" is actually the Base64 encoded version of your page-state. That way, a user opnening several instances of your page in multiple browser windows/tabs will see what he expects (possibly ;)) Btw., don't worry about asking basic questions, that's ok, of course. Marcus -- Marcus Schulte http://marcus-schulte.blogspot.com