jsf 2 - How and when is a @ViewScoped bean destroyed in JSF? -


the lifecycle of @requestscoped , @sessionscopedbean managed beans managed servlet container since stored attribute of httprequest , httpsession respectively. how jsf manage lifecycle of @viewscopedbean ? know gets created when view created , usable till there postback different view. found out not garbage collected after move view.

it destroyed when

  • a postback non-null outcome been performed,

  • or, number of (logical) views in session has exceeded , particular view first 1 in lru chain (in mojarra, that's configureable com.sun.faces.numberofviewsinsession , com.sun.faces.numberoflogicalviews context parameters, each default value of 15),

  • or, number of actieve view scopes in session has exceeded (in mojarra, that's hardcoded limit of 25), see jsf 2.2 memory consumption: why mojarra keep viewscoped beans of last 25 views in memory?

  • or, session has expired.

it not destroyed when page unloaded result of clicking link page, or refreshing page, or closing browser tab/window. bean live long until 1 of abovelisted conditions met. destroy during unload anyway, consider using omnifaces @viewscoped instead.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -