Kristian Marinkovic wrote:
you cannot useThreadLocal to store your data because when you return the page (string or class ... ) tapestry will perform a
http redirect. and because every request will have its own new
thread the ThreadLocal will be gone!
I do use ASOs and @Persist in a tabbed application and it works
fine
Can I assume you just have one variable in your ASO for the state and that this works as long as you don't have two links being followed at the same time. An alternate solution would be to store the states in some global cache (which is injected) and to be able to pass a state-id to the new page. However, I then get back to being able to pass a parameter to the referenced page.

Joachim
g,
kris




Joachim Van der Auwera <[EMAIL PROTECTED]> 04.12.2007 16:10
Bitte antworten an
"Tapestry users" <users@tapestry.apache.org>


An
Tapestry users <users@tapestry.apache.org>
Kopie

Thema
Re: Antwort: page navigation (return to arbitrary page)







Hmm, I don't like the ASO approach as that is not sompatible with having multiple tabs and/or back button. I assume I could have a class which traverses the fields marked with "@Persist" and store these in an object. On the link, the page name could be returned and the state stored in a threadlocal. The onActivate could then re-set the state from the threadlocal and clear the threadlocal.

Kind regards,
Joachim

Kristian Marinkovic wrote:
i'd recommend to use ApplicationStateObjects (ASOs) if you want to share state between multiple pages.
You could also have an ASO that returns the next or
previous page based on the current state
g,
kris



Joachim Van der Auwera <[EMAIL PROTECTED]> 04.12.2007 15:44
Bitte antworten an
"Tapestry users" <users@tapestry.apache.org>


An
Tapestry users <users@tapestry.apache.org>
Kopie

Thema
Re: Antwort: page navigation (return to arbitrary page)







Kristian Marinkovic wrote:

you could change your setReturnPage method to store a string with the page name or a Class instance of the return page....

If I do that, I completely lose state. I could store and restore the state if there was a way to get a page when the class or name is
provided.
Now, I think I can only use "InjectPage" but this would require the page

name to be known in advance, which is again not the case.

Any ideas how to solve that one?

Joachim



eg,
Object onActionFromLink()
{
    // initialize
    destinationPage.setReturnPage(ReturnPage.class);
    return destination;
}

g,
kris



Joachim Van der Auwera <[EMAIL PROTECTED]> 04.12.2007 15:27
Bitte antworten an
"Tapestry users" <users@tapestry.apache.org>


An
"users@tapestry.apache.org >> Tapestry users"
<users@tapestry.apache.org>

Kopie

Thema
page navigation (return to arbitrary page)







I have situation where I have a page in my application which can be
reached from many different pages. When a certain link is indicated, I
want the user to move back to the previous page. The problem is that
this class has no idea (cannot know) what the possible return pages
are.
I thought about using a mechanism like the following, on the originator
pages, include an actionlink component with the following code

---- OriginatorPage

@InjectPage
private DestinationPage destination;

Object onActionFromLink()
{
    // initialize
    destinationPage.setReturnPage( this );
    return destination;
}
-----

On the destination page, I would have another actionlink to get back to
the originator page.

----- DestinationPage

@Persist
private Object returnPage;

public void setReturnPage( Object o ) { returnPage = o; }

Object onActionFromLinkback()
{
    return page;
}

-----

Unfortunately this does not work, presumably because the originator
page
is detached.

Is there some way serialize/deserialize a page so that I can be used?

It would be possible to add two methods which store/restore all the
persisted fields, but I still need to be able to attach/inject a page
of
which the page name is not known in advance.

Any suggestions?

Thanks for the help,
Joachim








--
Joachim Van der Auwera
PROGS bvba, progs.be


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

Reply via email to