简体   繁体   English

JSF跳过阶段 - 如何调试?

[英]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? 有没有人有类似的问题?


Update 更新

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组件无法调用关联的操作时,请验证以下内容:

  1. UICommand components must be placed inside an UIForm component (eg h:form ). UICommand组件必须放在UIForm组件内(例如h:form )。
  2. You cannot nest multiple UIForm components in each other (watch out with include files!). 您不能将多个UIForm组件嵌套 UIForm (注意包含文件!)。
  3. No validation/conversion error should have been occurred (use h:messages to get them all). 不应该发生验证/转换错误(使用h:messages来获取它们)。
  4. If UICommand components are placed inside an UIData component, ensure that exactly the same DataModel (the object behind the UIData 's value attribute) is preserved. 如果将UICommand组件放在UIData组件中,请确保UIData完全相同的DataModelUIDatavalue属性后面的对象)。
  5. The rendered and disabled attributes of the component and all of the parent components should not evaluate to false during apply request values phase. 在应用请求值阶段,组件和所有父组件的rendereddisabled属性不应评估为false
  6. Be sure that no PhaseListener or any EventListener in the request-response chain has changed the JSF lifecycle to skip the invoke action phase. 确保请求 - 响应链中没有PhaseListener或任何EventListener更改了JSF生命周期以跳过调用操作阶段。
  7. Be sure that no Filter or Servlet in the same request-response chain has blocked the request fo the FacesServlet somehow. 确保同一请求 - 响应链中没有FilterServlet以某种方式阻止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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM