JSF UIComponent binding, serializable and view scoped

拈花ヽ惹草 提交于 2019-12-13 15:01:42

问题


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}"> ... 

The UIComponent is not serializable and thus breaking session restore.

What's the best practice here?

Should I just mark the UIComponents as transient? Or is it bad practice to use binding= to anything but a request-scoped bean?

I'm using Glassfish 3.1.1, Mojarra 2.1.3 and PrimeFaces 2.2.


回答1:


Accepting @BalusC's suggestion to find another way to solve problem without binding.



来源:https://stackoverflow.com/questions/8392236/jsf-uicomponent-binding-serializable-and-view-scoped

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