问题描述
我有一个实现序列化
和 UIComponent
通过绑定传递视图作用域的bean。
I have a view-scoped bean that implements Serializable
, and a UIComponent
passed in via binding.
@ManagedBean
@ViewScoped
public class ViewScopedBean implements Serializable {
UIComponent form;
/// ...
}
<h:form binding="#{viewScopedBean.form}"> ...
的 UIComponent
不是序列化的,因而打破会话恢复。
The UIComponent
is not serializable and thus breaking session restore.
什么是最好的做法在这里?
What's the best practice here?
如果我只是标记的UIComponents为瞬态
?或者是不好的做法,使用绑定=要什么,但一个请求范围豆?
Should I just mark the UIComponents as transient
? Or is it bad practice to use binding= to anything but a request-scoped bean?
我用Glassfish的3.1.1,2.1.3 Mojarra和PrimeFaces 2.2。
I'm using Glassfish 3.1.1, Mojarra 2.1.3 and PrimeFaces 2.2.
推荐答案
接受@ BalusC的建议,找到另一种方式来解决问题,而无需绑定。
Accepting @BalusC's suggestion to find another way to solve problem without binding.
这篇关于JSF UIComponent绑定,序列化和视图范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!