gpt4 book ai didi

jsf - 查找 : "The form component needs to have a UIForm in its ancestry." 的原因

转载 作者:行者123 更新时间:2023-12-04 22:31:47 24 4
gpt4 key购买 nike

有什么方法可以确定哪一行(甚至是什么文件)导致

The form component needs to have a UIForm in its ancestry. Suggestion: enclose the necessary components within



来自 Primefaces 的警告信息?我刚刚开始处理一个已建立的项目,其中包含许多带有各种模板和继承的 .xhtml 文件(由其他人编写),但我无法确定导致问题的文件的范围。

我试过谷歌搜索但没有运气,我找不到关于如何找到错误来源的答案。

更新 : 不是去url中显示的页面那么简单。例如,当我导航到 '../foo.xhtml' 时会显示警告。然而, foo.xhtml实现一个模板并包含多个其他 .xhtml文件(每个文件又包含几个 .xhtml 文件)。所有文件都有些大(至少 500 行)。

最佳答案

FormOmittedChecker#check() 中放置调试断点,内if块在哪里isInNeedOfForm(component)已返回 true , 即 line 99从 Mojarra 2.2.12 开始。

   96                    if (isForm(component)) {
97 result = VisitResult.REJECT;
98 } else if (isInNeedOfForm(component)) {
* 99 addFormOmittedMessage(finalContext);
100 }

给定一个页面,其输入字段没有 <h:form> ,
<h:inputText id="someInputText" />

断点命中将在 Eclipse 中如下所示:



正如您在屏幕截图中看到的,您可以检查 component变量堆栈中的变量,然后检查其 clientId (或 id)属性。最后,您可以在生成的 HTML 输出和/或 JSF 源代码中找到并关联它。

但是,我同意该消息应包含更好的诊断信息。根据 issue 4026,这已在 Mojarra 2.3.0-m04 中修复.

关于jsf - 查找 : "The form component needs to have a UIForm in its ancestry." 的原因,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38378340/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com