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?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Mahmoud Saleh
  • 33,303
  • 119
  • 337
  • 498

1 Answers1

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.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • i am using JSF 2 Mojarra (api from javax.faces & impl from com.sun.faces: ` com.sun.faces jsf-api 2.1.0-b11 compile com.sun.faces jsf-impl 2.1.0-b11 compile ` – Mahmoud Saleh Oct 13 '11 at 09:29
  • 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. – Joshua Davis Dec 15 '11 at 15:53
  • @BalusC 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. – Ced Oct 17 '15 at 21:51