JSF UIComponent绑定,序列化和视图范围 [英] JSF UIComponent binding, serializable and view scoped

查看:348
本文介绍了JSF UIComponent绑定,序列化和视图范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个实现序列化 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绑定,序列化和视图范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆