[英]JSF skips phases - How to debug that?
I'm debugging a foreign JSF application. 我正在调试一个外部JSF应用程序。 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. 使用阶段监听器,我可以看到生命周期没有完全运行,所以说它跳过阶段2 -5:在恢复视图阶段之后,直接调用渲染响应阶段。 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. 因此,这可能是一个鸡与蛋的问题:1。不会调用负责阶段,因此新表单输入无法结转。 2. The system doesn't recognize any new input and therefore directly renders after restoring the view.
2.系统无法识别任何新输入,因此在恢复视图后直接渲染。
I checked that there is no call of responseComplete() oder renderResponse(). 我检查了没有调用responseComplete()或者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?
有没有人有类似的问题?
I have a suspicion, that JSF isn't aware of the postback request and handles this like an initial view . 我怀疑,JSF不知道回发请求,并像初始视图一样处理它。 That would explain, that I only pass phase 1 & 6.
这可以解释,我只通过了第1阶段和第6阶段。
How can I check, if JSF recognizes this as a non-faces-request ? 如果JSF将此识别为非面部请求 ,我该如何检查?
How can I check, if there is the appropriate treeID in the current facesContext
. 如果当前
facesContext
有适当的treeID ,我该如何检查。
I'm quoting from an answer I've posted before : 我是从我已经张贴一个答案引用之前 :
Whenever an
UICommand
component fails to invoke the associated action, verify the following:每当
UICommand
组件无法调用关联的操作时,请验证以下内容:
UICommand
components must be placed inside anUIForm
component (egh:form
).UICommand
组件必须放在UIForm
组件内(例如h:form
)。- You cannot nest multiple
UIForm
components in each other (watch out with include files!).您不能将多个
UIForm
组件嵌套UIForm
(注意包含文件!)。- No validation/conversion error should have been occurred (use
h:messages
to get them all).不应该发生验证/转换错误(使用
h:messages
来获取它们)。- If
UICommand
components are placed inside anUIData
component, ensure that exactly the sameDataModel
(the object behind theUIData
'svalue
attribute) is preserved.如果将
UICommand
组件放在UIData
组件中,请确保UIData
完全相同的DataModel
(UIData
的value
属性后面的对象)。- The
rendered
anddisabled
attributes of the component and all of the parent components should not evaluate tofalse
during apply request values phase.在应用请求值阶段,组件和所有父组件的
rendered
和disabled
属性不应评估为false
。- Be sure that no
PhaseListener
or anyEventListener
in the request-response chain has changed the JSF lifecycle to skip the invoke action phase.确保请求 - 响应链中没有
PhaseListener
或任何EventListener
更改了JSF生命周期以跳过调用操作阶段。- Be sure that no
Filter
orServlet
in the same request-response chain has blocked the request fo theFacesServlet
somehow.确保同一请求 - 响应链中没有
Filter
或Servlet
以某种方式阻止FacesServlet
的请求。
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. 由于在您的特定情况下,已跳过阶段2-5并且您确定(?)未调用
FacesContext#renderResponse()
,因此可能会从列表中FacesContext#renderResponse()
原因3,6和7。 The causes 4 and 5 can likely also be scratched, depending on the way how you debugged the JSF phases. 原因4和5也可能被划伤,具体取决于您调试JSF阶段的方式。 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. 我的原因2.检查您是否在生成的HTML源代码中没有看到
<form><form></form></form>
,并在JSF源代码中回溯它。
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.
我很抱歉,但我认为这是非常具体的应用程序:JSF的自定义StateManager不适用于JSF 1.2。 That caused this strange error.
这引起了这个奇怪的错误。 Got the StateManager fixed and everything worked fine.
修好了StateManager,一切正常。 That's bitter and cost a lot of time :-(
这很苦,花了很多时间:-(
Thanks for your help anyway :-) 还是要谢谢你的帮助 :-)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.