t:DataTable抛出Not Serializable Exception

时间:2014-04-23 05:53:04

标签: java jsf tomahawk

我正在使用JSF 2.0tomahawk 2.0websphere v8.5。当我从数据库填充值时,我收到t:dataTable的错误,它会抛出异常java.io.NotSerializableException: org.apache.myfaces.component.html.ext.HtmlDataTable我的支持bean implements serialization,它是@ViewScope

public class Templates implements Serializable
{
... 
}

faces-config.xml中

<managed-bean>
        <managed-bean-name>templates </managed-bean-name>
        <managed-bean-class>cms.Templates</managed-bean-class>
        <managed-bean-scope>view</managed-bean-scope>
</managed-bean>

1 个答案:

答案 0 :(得分:0)

我解决了这个问题ref:here,因为类是序列化的,HtmlDataTable是类的变量,不应该被序列化所以我只需要这个transient