Theo
Theo

Reputation: 43

What's the recommended JSF 2.0 scope for a CRUD application?

I was wondering which scope to use for a CRUD Application. Using @ReqeustScoped causes an access to the database for every request. With @SessionScoped, data can be cached in the managed bean, but can cause the so called session-bloat. Moreover, it is more difficult to keep the data up to date. What would you recommend? Is there a best-practice solution. Thanks, Theo

Upvotes: 4

Views: 5304

Answers (1)

BalusC
BalusC

Reputation: 1108852

Right, you want the scope there in between: @ViewScoped. This scope lives as long as you're submitting and navigating to the same view.

See also:

Upvotes: 2

Related Questions