The form component needs to have a UIForm in its ancestry. Suggestion: enclose the necessary components within <h:form>
Asked Answered
C

1

11

I am getting the following error on my Facelet page, which simply consists of an IceFaces form with two fields and two buttons:

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

Here is the form:

<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>

How is this caused and how can I solve it?

Condenser answered 12/10, 2011 at 13:44 Comment(0)
V
15

This is not an error. This is a warning. The code looks fine, all input components are inside a form, it seems that it should run and work fine. If it indeed works fine, just ignore the warning. This warning is displayed only when the context parameter javax.faces.PROJECT_STAGE is set to Development anyway .

As to the false warning message itself, this check was introduced in Mojarra 2.1.1 as per issue 1663. However, as per issue 2147 it turns out to have some bugs and is been further improved in Mojarra 2.1.3. I'd imagine that the false warning is in your particular case caused by having an <ice:panelLayout> between the form and the input elements.

If you aren't on Mojarra 2.1.3 yet, you may want to consider upgrading to see if it removes the false warning message.

Vitriolize answered 12/10, 2011 at 17:31 Comment(3)
i am using JSF 2 Mojarra (api from javax.faces & impl from com.sun.faces: <dependency> <groupId>com.sun.faces</groupId> <artifactId>jsf-api</artifactId> <version>2.1.0-b11</version> <scope>compile</scope> </dependency> <dependency> <groupId>com.sun.faces</groupId> <artifactId>jsf-impl</artifactId> <version>2.1.0-b11</version> <scope>compile</scope> </dependency>Condenser
FYI: I'm using JBoss AS 7.0.2.Final, which comes with "Mojarra 2.1.3 (SNAPSHOT 20110825)" and I do see this message on one of my pages.Linton
@Vitriolize Is there any way to prevent those from being displayed as face messages while staying on development stage ? Because I've those messages all over my pages and it's annoying to design with this useless message.Sahib

© 2022 - 2024 — McMap. All rights reserved.