Which scope to use for a series of pages, each dependent on the previous page?

删除回忆录丶 提交于 2019-12-07 12:01:28
kolossus

Depending on the tenure of the data you're storing, whether the pages actually occur in the sequence you listed and how much typing you're inclined to, you could use either

  1. Flash scope: This is scope is ideal for transfer of strictly temporary information between beans and pages. At first blush, it appears this scope would be ideal for your use case. I must emphasise the temporary nature of the data stored in this scope. It's also probably a good thing to point out that early versions of the implementations of this scope (especially with mojarra) had problems, so use at your own peril. I personally have not had any problems with the scope, so it really boils down to the version of JSF you're running

    Using the flash scope:

  2. @SessionScoped: This scope, as you're already aware lasts really long. If the data you're using would likely outlast the beans/pages you've listed here, this is the way to go. It'll also survive refreshes and redirects without any problems (and there's the added benefit of doing less work to persist and reuse the data)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!