JSF 跳过阶段 - 如何调试?
我正在调试一个外部 JSF 应用程序。 问题是,我提交了表单,但值没有保留。
通过阶段侦听器,我可以看到生命周期并未完全运行,也就是说它跳过了阶段 2 -5:在恢复视图阶段之后,直接调用渲染响应阶段。我怀念应用值、验证、更新模型操作等。
所以,这可能是一个先有鸡还是先有蛋的问题: 1. 不调用负责的阶段,因此无法继承新的表单输入。 2. 系统无法识别任何新输入,因此恢复视图后直接渲染。
我检查没有调用responseComplete()或renderResponse()。
我不知何故被困住了。有什么想法可以验证这两个假设之一吗?或者一般如何调试?有人遇到过类似的问题吗?
更新
我怀疑 JSF 不知道回发请求,并像处理初始视图一样处理此请求。这就解释了,我只通过了第一阶段和第二阶段。 6.
如何检查 JSF 是否将其识别为非面孔请求?
如何检查当前 facesContext
中是否存在适当的treeID。
I'm debugging a foreign JSF application.
The problem is, that I submit a form, but the values aren't carried over.
With a phase listener I can see, that the life cycle doesn't run completely through, so to say it skips phase 2 -5: After the restore view phase, the render response phase is directly called. I miss the apply values, validation, update model actions and so on.
So, this could be a chicken-and-egg problem:
1. The responsible phases aren't called, so the new form input can't be carried over.
2. The system doesn't recognize any new input and therefore directly renders after restoring the view.
I checked that there is no call of responseComplete() oder renderResponse().
I'm stuck somehow. Any idea to validate one of the two hypothesis? Or how to debug that in general? Did anybody have a similar problem?
Update
I have a suspicion, that JSF isn't aware of the postback request and handles this like an initial view. That would explain, that I only pass phase 1 & 6.
How can I check, if JSF recognizes this as a non-faces-request?
How can I check, if there is the appropriate treeID in the current facesContext
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我引用我之前发布的答案:
由于在您的特定情况下,阶段 2-5 被跳过并且您确定(?)没有调用 FacesContext#renderResponse(),因此原因 3、6 和 7 可以是从列表中删除。原因 4 和 5 也可能被排除,具体取决于您调试 JSF 阶段的方式。调查其他原因。我对原因 2 的看法。检查您是否在生成的 HTML 源代码中没有看到
并在 JSF 源代码中回溯。
I'm quoting from an answer I've posted before:
Since in your particular case the phases 2-5 are been skipped and that you're certain(?) that
FacesContext#renderResponse()
isn't been called, the causes 3, 6 and 7 can be scratched from the list. The causes 4 and 5 can likely also be scratched, depending on the way how you debugged the JSF phases. Investigate the other causes. My cents on cause 2. Check if you don't see<form><form></form></form>
in generated HTML source and backtrack this in JSF source.找到解决方案了!
很抱歉,但我猜这是非常特定于应用程序的:JSF 的自定义 StateManager 无法与 JSF 1.2 一起使用。这导致了这个奇怪的错误。
修复了 StateManager,一切正常。这很痛苦并且花费了很多时间:-(
无论如何感谢您的帮助:-)
Found the solution!
I'm sorry but it was very application specific I guess: The custom StateManager for JSF wasn't usable with JSF 1.2. That caused this strange error.
Got the StateManager fixed and everything worked fine. That's bitter and cost a lot of time :-(
Thanks for your help anyway :-)