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

This is just a Warning not an Error. Warnings are usually there to inform the developer about unforeseen situations/conditions which might not immediately cause technical errors/problems. Anything may just work flawlessly, but the behaviour/results may probably not be as the developer intented. A newbie developer may for example accidently have used <form> instead of <h:form>. Warnings like this are then helpful.

In your particular case, you are simply forced to use <form> because of the need to submit to a non-JSF service. You as a more experienced developer know that it's legitimately valid. You can just ignore this warning. This warning will only appear when javax.faces.PROJECT_STAGE is set to Development anyway and not appear when it is set to Production.

However, that it still displays the warning when there's another component like panelgrid in between the form and its input children, is a bug to me. I'd report it to the Mojarra guys. It look like as if it is checking the immediate parent only and not all of the parents. Update: it has been fixed as per Mojarra 2.1.3/2.2, see also issue 2147.

This is by the way not Glassfish specific. The newer GF version of course ships with a newer Mojarra version which has those warnings implemented. See also issue 1663.

Related questions:

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

This was suggested to me by Oleg from the PrimeFaces forum and works:

<h:form id="login" prependId="false"
                onsubmit="document.getElementById('login').action='j_security_check';">

Regards, Brendan.


It only shows if you are in JSF Development based on your web config.

<context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>

When you change it to Production it wont show anymore

Tags:

Forms

Jsf

Jsf 2