You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Leon Derks <le...@cumquat.nl> on 2008/05/08 14:54:39 UTC

@Persist("flash") question

In my page I have a the following function that is executed when I click 
on the search button in my page.

@Persist("flash")
private List<ImportRequest> importRequests = new ArrayList<ImportRequest>();

@OnEvent(component = "searchForm", value = "submit")
    public void doSearch() {
        importRequests = importDAO.findImportRequests(importRequestSearch);
    }

The results are only shown on my page when I use @Persist("flash") for 
the importRequests.

Is it possible to do this without an @Persist("flash")?

Leon

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


Re: @Persist("flash") question

Posted by Thiago HP <th...@gmail.com>.
Try this:

    @Persist("flash")
    private String importRequestSearch;

    public List<ImportRequest> getImportRequests() {
        return importDAO.findImportRequests(importRequestSearch);
    }

This way, you store less information in the session (just the search
criteria, not the search result). And you must use @Persist("flash"),
as Tapestry uses redirect-after-post by default.

-- 
Thiago

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


RE: @Persist("flash") question

Posted by Kristian Marinkovic <kr...@porsche.co.at>.
hi leon,

Tapestry 5 uses a redirect to display the result of a component action.
Therefore the data has to be saved/stored between the two requests.
(i call the first request action request and the second request render
request as it will then render the page)

"flash" will store the data in the session and remove it after the render
request

of course... if you, for example, use Hibernate with second-level caching 
you  could have a getImportRequsts method reading the data from the DAOs
on every render request 

getImportRequests() {
    return importDAO.findImportRequests(importRequestSearch);
}

please read http://tapestry.apache.org/tapestry5/tapestry-core/ 
(at the end)

or watch the screencasts (although a bit outdated an example/answer why
persist is needed is available)

http://tapestry.apache.org/tapestry5/screencast.html

g,
kris




Leon Derks <le...@cumquat.nl> 
08.05.2008 14:54
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>


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

Thema
@Persist("flash") question







In my page I have a the following function that is executed when I click 
on the search button in my page.

@Persist("flash")
private List<ImportRequest> importRequests = new 
ArrayList<ImportRequest>();

@OnEvent(component = "searchForm", value = "submit")
    public void doSearch() {
        importRequests = 
importDAO.findImportRequests(importRequestSearch);
    }

The results are only shown on my page when I use @Persist("flash") for 
the importRequests.

Is it possible to do this without an @Persist("flash")?

Leon

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