即使使用服务器设置,MyFaces @ViewScoped 也会抛出 NotSerializedException
因此,我希望使用 ViewScoped
,当我将状态保存方法设置为客户端时,页面将抛出 NotSerializedException
并且页面将转发到错误页面。当我切换到服务器状态保存时,仍然会引发异常,但页面会加载。
我阅读了许多问题和答案,感觉 ViewScoped/服务器状态保存的组合将消除将所有内容标记为可序列化的需要。有人看到这个问题吗?
Richfaces 4.1/Myfaces 2.1.5
So I wish to use ViewScoped
and when I set the state saving method to client the page will throw a NotSerializableException
and the page will forward to the error page. When I switch to server state saving, the exception is still thrown but the page will load.
I read through many questions and answers and was under the impression that the combination of ViewScoped/server state saving will eliminate the need to have everything marked as Serializable. Anyone see this issue?
Richfaces 4.1/Myfaces 2.1.5
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为设置此 servlet 上下文参数将解决该问题:
这将阻止 MyFaces 在将状态保存到会话中之前序列化状态。这样做是默认原因。我认为这是为了节省内存。
I think setting this servlet context parameter will solve the issue:
This will prevent MyFaces from serializing the state before saving it in the session. Doing so is the default reason. I think it's for saving memory.
如果您使用 CDI,则可以使用 MyFaces CODI。它修复了这个问题,您可以使用 @ViewScoped beans 作为 CDI bean。
If you are using CDI, you can use MyFaces CODI. It fixes this issue and you can use @ViewScoped beans as CDI bean.