Skip to main content

@ViewScope - Is it safe?

2 replies [Last post]
israelbgf
Offline
Joined: 2009-03-31

Is the ViewScope memory safe? I mean, does it contents really get destroyed when i change the view? I ask it because as far i know the @Page context of the Seam Framework does not, it only get "cleaned" when the maximum number of views per session expires (15 i think).

Seam FAQ about Page Scope:
http://seamframework.org/Documentation/WhenDoesThePageContextGetDestroyed

I dont know if the implementation logic is the same, so i'm just asking. :)

I was testing the @PreDestroy on a View scoped bean some days I go and it wasn't callled when i changed my view, so that's why i'm worried. And another thing, JSF have a different view tree for each view in each browser tab? So is the @ViewScope multi-tab friendly?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
rlubke
Offline
Joined: 2003-08-21

Currently it only destroys the view scope when the navigation result is not a redirect.

If you're testing against a recent nightly and the navigation was not a redirect, then please open an issue.

As to your last question, the scope is maintained as part of the view state. So if you have multiple tabs open accessing the same views, precautions will need to be made (same as session scoped content).

israelbgf
Offline
Joined: 2009-03-31

No answers? :(