重写 JSF 生命周期方法
每当调用 JSF 页面时,我都需要设置一些值。因此,我查看了生命周期方法,认为我将能够重写,例如,restoreView 方法,以便我可以将页面的某些属性设置为 null。但我似乎找不到任何人这样做的例子。如果您能给我指出一个教程或示例,或者让我知道这样做的正确方法是什么 - 我将不胜感激。谢谢!
大声思考:也许在 xhtml 生成中有一个阶段,我可以在支持 bean 上调用方法,并在呈现其他内容之前设置我的值?
I need to set some values whenever a JSF page is called. So I looked at the lifecycle methods, thinking I'll be able to override, for example, the restoreView method so that I can set to null some of the page's properties. But I can't seem to find any example of anyone doing so. If you can point me to a tutorial, or an example, or let me know what is the right way for doing so -- I'd greatly appreciate it. Thanks!
Thinking out loud: maybe there is a phase in the xhtml generation when I can call a method on the backing bean, and set my values before anything else is rendered?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据您的问题历史记录,您正在使用 JSF 2.0。所以,这应该可以:
但是
这没有什么意义,我不禁有这样的印象:您正在以错误的方向寻找解决方案。
Based on your question history, you're using JSF 2.0. So, this should do:
with
This makes however very little sense and I can't help having the impression that you're looking for the solution in the wrong direction.