用户之间是否共享JSF视图? [英] Are JSF Views shared between users?
问题描述
我在web.xml中将逻辑视图和会话属性中的视图的#定义为1,因此最多只能有1个视图.鉴于此,我有几个问题:
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:
-
此#特定于给定用户吗?就是说,这是否将每个用户的观看次数限制为1? **如果是,是否可以在多个用户中使用同一JSP的多个视图表示形式?
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?
是否有一种在用户之间共享JSF视图的方法(假设该视图是通用的并且不包含任何用户特定的数据)?
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)?
谢谢!
推荐答案
如果您对用户"的通用定义实际上等于"HTTP会话",那么是的,您是对的.视图基本上存储在HTTP会话中,并由名称为javax.faces.ViewState
的隐藏HTML输入字段引用.不同的HTTP会话将不会彼此共享其视图,否则显然将是一个巨大的错误和安全漏洞.
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.
通过将会话中(逻辑)视图的数量设置为1
,您就消除了用户可以在同一会话的不同窗口/选项卡中使用包含POST表单的多个视图的可能性.最终用户每次打开新窗口/标签时,只要最终用户在上一个窗口/标签中触发POST请求,最终用户都将收到ViewExpiredException
,因为您已将其配置为仅保留一个视图在会话中,这是最后打开的会话.
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.
这篇关于用户之间是否共享JSF视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!