【问题标题】:The form component needs to have a UIForm in its ancestry. Suggestion: enclose the necessary components within <h:form>表单组件需要在其祖先中有一个 UIForm。建议:将必要的组件包含在 <h:form> 中
【发布时间】:2011-12-06 03:55:42
【问题描述】:

我的 Facelet 页面上出现以下错误,该页面仅包含一个带有两个字段和两个按钮的 IceFaces 表单:

表单组件需要在其祖先中有一个 UIForm。建议:将必要的组件包含在

这是表格:

<ice:form id="form1" partialSubmit="false">
    <ice:panelLayout id="panelLayout3">
        <ice:graphicImage id="graphicImage1" url="/resources/images/LoginImage.jpg" width="560" />
        <ice:outputLabel for="j_username" id="outputLabel1" value="Username:"/>
        <ice:outputLabel for="j_password" id="outputLabel2" value="Password:"/>
        <ice:inputText binding="#{login.username}" id="j_username" required="true" />
        <ice:inputSecret binding="#{login.password}" id="j_password" required="true" />
        <ice:commandButton  actionListener="#{login.login}" id="loginBtn" value="Login"/>
        <ice:commandButton action="#{login.reset}" id="resetBtn" value="Reset"/>
        <ice:outputText id="errorMessage" />
        <ice:message errorClass="errorMessage" for="j_username" fatalClass="fatalMessage" id="messages1" infoClass="infoMessage" showSummary="false" warnClass="warnMessage"/>
    </ice:panelLayout>
</ice:form>

这是怎么引起的,我该如何解决?

【问题讨论】:

    标签: jsf jsf-2 icefaces


    【解决方案1】:

    这不是错误。这是一个警告。代码看起来不错,所有输入组件都在一个表单中,看起来它应该可以正常运行。如果它确实工作正常,请忽略警告。仅当上下文参数javax.faces.PROJECT_STAGE 无论如何设置为Development 时才会显示此警告。

    至于错误警告消息本身,此检查是在 Mojarra 2.1.1 中根据issue 1663 引入的。然而,根据issue 2147,事实证明它存在一些错误,并且在 Mojarra 2.1.3 中得到了进一步改进。我想在您的特定情况下,错误警告是由表单和输入元素之间的&lt;ice:panelLayout&gt; 引起的。

    如果您还没有使用 Mojarra 2.1.3,您可能需要考虑升级以查看它是否会删除错误的警告消息。

    【讨论】:

    • 我正在使用 JSF 2 Mojarra(来自 javax.faces 的 api 和来自 com.sun.faces 的 impl:&lt;dependency&gt; &lt;groupId&gt;com.sun.faces&lt;/groupId&gt; &lt;artifactId&gt;jsf-api&lt;/artifactId&gt; &lt;version&gt;2.1.0-b11&lt;/version&gt; &lt;scope&gt;compile&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;com.sun.faces&lt;/groupId&gt; &lt;artifactId&gt;jsf-impl&lt;/artifactId&gt; &lt;version&gt;2.1.0-b11&lt;/version&gt; &lt;scope&gt;compile&lt;/scope&gt; &lt;/dependency&gt;
    • 仅供参考:我使用的是 JBoss AS 7.0.2.Final,它带有“Mojarra 2.1.3 (SNAPSHOT 20110825)”,我确实在我的一个页面上看到了这条消息。
    • @BalusC 有什么办法可以防止那些在开发阶段被显示为面部信息吗?因为我的页面上到处都是这些信息,用这种无用的信息进行设计很烦人。
    猜你喜欢
    • 2016-07-14
    • 2016-11-17
    • 2012-08-02
    • 2013-07-30
    • 1970-01-01
    • 1970-01-01
    • 2014-04-27
    • 2015-09-22
    相关资源
    最近更新 更多