JSF 应用程序跨越用户会话数据
我正在尝试解决一个棘手的 JSF 问题。注意,我对 JSF 和 Java 相当陌生......我有一个简单的应用程序,用户登录,选择一些复选框,单击提交,在另一个页面上添加一些更多信息,保存到数据库并注销。
在我的生产环境中,我看到用户会话数据被交叉或缓存并由后续用户会话拾取的实例。例如,用户 A 输入数据,然后用户 B 输入数据,在查看他的数据时,他会看到用户 A 输入的内容。当然,我无法在测试中重新创建它。
我正在使用 jsf 1.2._12、richfaces 3.3.2 和 spring 2.5.6。应用程序服务器是 JBoss 5。
我所有的 JSF 托管 bean 都是会话范围的。这个特定的托管 bean 调用 spring bean 作为我的业务对象,该对象是会话范围的,最终调用单例的 DAO。
这里是相关的 faces-config 信息
<managed-bean>
<description>ContactBean</description>
<managed-bean-name>ContactBean</managed-bean-name>
<managed-bean-class>com.package.ContactBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>dataElementBO</property-name>
<value>#{dataElementBO}</value>
</managed-property>
<managed-property>
<property-name>attributeBO</property-name>
<value>#{attributeBO}</value>
</managed-property>
<managed-property>
<property-name>dataElement2BO</property-name>
<value>#{dataElement2BO}</value>
</managed-property>
<managed-property>
<property-name>submissionBO</property-name>
<value>#{submissionBO}</value>
</managed-property>
<managed-property>
<property-name>selectedList</property-name>
<property-class>java.util.ArrayList</property-class>
<list-entries />
</managed-property>
<managed-property>
<property-name>enteredContact</property-name>
<property-class>java.util.ArrayList</property-class>
<list-entries />
</managed-property>
</managed-bean>
和我的 spring bean 的应用程序上下文被调用
<bean id="submissionBO" class="com.package.submissionBOImpl" scope="session">
<property name="submissionDAO">
<ref bean="submissionDAO" />
</property>
</bean>
在查看我的网络服务器日志时,当用户 A 和 B 甚至没有同时登录时,就会发生此问题。用户 A 注销,大约 20 分钟后用户 B 登录。
我不明白会话作用域 bean 的使用如何可能在其他用户数据中交叉...是否有什么我不明白它们的作用域如何?如果需要,我可以附加一些模拟代码。提前致谢!
I have a difficult JSF issue I am trying to solve. Note, I am fairly new to JSF and Java....I have a simple application where users login, select some checkboxes, click submit, add some more info on another page, save to DB and logout.
In my Production env, I am seeing instances where user session data is getting crossed or cached and pickup by a subsequent user session. For example, User A enters data, then User B enters data and upon reviewing his data, he sees stuff User A entered. Of course, I cannot recreate this in test.
I am using jsf 1.2._12, richfaces 3.3.2, and spring 2.5.6. The app server is JBoss 5.
All of my JSF managed-beans are session scoped. This particular managed bean calls a spring bean as my Business object which is session scoped, which ultimately calls a DAO that is singleton.
Here the relavant faces-config info
<managed-bean>
<description>ContactBean</description>
<managed-bean-name>ContactBean</managed-bean-name>
<managed-bean-class>com.package.ContactBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>dataElementBO</property-name>
<value>#{dataElementBO}</value>
</managed-property>
<managed-property>
<property-name>attributeBO</property-name>
<value>#{attributeBO}</value>
</managed-property>
<managed-property>
<property-name>dataElement2BO</property-name>
<value>#{dataElement2BO}</value>
</managed-property>
<managed-property>
<property-name>submissionBO</property-name>
<value>#{submissionBO}</value>
</managed-property>
<managed-property>
<property-name>selectedList</property-name>
<property-class>java.util.ArrayList</property-class>
<list-entries />
</managed-property>
<managed-property>
<property-name>enteredContact</property-name>
<property-class>java.util.ArrayList</property-class>
<list-entries />
</managed-property>
</managed-bean>
And my app-Context for the spring bean getting called
<bean id="submissionBO" class="com.package.submissionBOImpl" scope="session">
<property name="submissionDAO">
<ref bean="submissionDAO" />
</property>
</bean>
In viewing my webserver logs, this issue occurred when User A and B weren't even logged in at the same time. User A logged out and then User B logged in almost 20 minutes later.
I don't understand how the use of session scoped beans could possibly cross in other users data... is there something I don't understand about how these are scoped? I can attach some mocked up code if needed. Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
提交和审核页面是否使用相同的托管 bean?如果不是你如何将数据传递到其他页面?
Are submit and review pages using same managed-bean? If not how you passed data to other page?