Are JSF Views shared between users?

 ̄綄美尐妖づ 提交于 2019-12-09 02:08:32

问题


I've defined the # of logical views and views in session attributes in web.xml to 1, so that there is only a maximum of 1 view. Given that, I've a couple of questions:

  • Is this # specific to a given user? Meaning, does this limit the # of views to 1 per user? ** If yes, could there be multiple view representations of the same JSP across multiple users?

  • Is there a way to share the JSF view across users (given that the view is rather generic and does not contain any user specific data)?

Thanks!


回答1:


If your generic definition of "an user" actually equals to "a HTTP session", then yes, you're right. Views are basically stored in the HTTP session and referenced by a hidden HTML input field with the name javax.faces.ViewState. Different HTTP sessions will not share their views with each other, that would otherwise obviously have been a huge bug and security hole.

With setting the number of (logical) views in session to 1, you're however removing the possibility that the user can use multiple views containing POST forms in different windows/tabs in the same session. Everytime the enduser opens a new window/tab, the enduser will receive a ViewExpiredException whenever the enduser fires a POST request in a previous window/tab, because you've configured it to keep only one view in the session, which is the last opened one.



来源:https://stackoverflow.com/questions/6915055/are-jsf-views-shared-between-users

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