4

I'm using JSF and RichFaces 4. I have a huge form which I have to split into several panels. But when I do, I get the warning.

For example this makes it display the warning:

<h:form>
    <rich:tabPanel>
        <rich:tab>
            //Form elements go here
        </rich:tab>
    </rich:tabPanel>
</h:form>

How do I avoid it?

Carlos Vergara
  • 3,592
  • 4
  • 31
  • 56
  • 1
    I'm splitting one form in several tabs just because the form is huge. I don't want to process each tab separately, I want to process the whole form. – Carlos Vergara Aug 05 '12 at 01:23
  • Which I do, and that's not the problem. However richfaces throws a warning when I do it the way I'm showing in my post - if I place a form element (such as h:inputText) inside a tab, inside a tabpanel, inside a form, I get a "The button/link/text component needs to have a Form in its ancestry. Please add " error. – Carlos Vergara Aug 05 '12 at 01:25
  • I'm not, I'm placing the form elements (such as inputs, selects and the like) inside a rich:tab, which is inside a rich:tabPanel, which is inside a h:form element. – Carlos Vergara Aug 05 '12 at 01:28
  • Ok I've understood your problem. Its very odd, I've used `` for a small application and it wasn't a problem, maybe you just added the at the end of your work, clean and build the project and the warning should dissapear. Also, make sure there is no component outside this form. – Luiggi Mendoza Aug 05 '12 at 01:32
  • So should I just ignore the warning? – Carlos Vergara Aug 05 '12 at 01:56
  • Try to make a sample at first, if it works, then the warning was an IDE bug and you should continue with your development. – Luiggi Mendoza Aug 05 '12 at 01:58
  • Each time I try to place form elements inside richfaces components, and them inside h:form, I get the error. This is not the first time I get this error, I had to give up using rich:panel for making another form friendlier. – Carlos Vergara Aug 05 '12 at 02:06

1 Answers1

9

First of all, this warning will only appear when javax.faces.PROJECT_STAGE is set to Development. So if everything works fine in spite of the warning, then you can safely ignore it. It won't appear in Production stage.

As to the false warning itself, in older Mojarra versions there was a bug which caused that. This bug has been reported as issue 2147 and is been fixed since Mojarra 2.1.3 which was released about one year ago (it's currently already at 2.1.11). So just upgrading Mojarra to at least 2.1.3 should get you rid of this false warning.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • How do I know which Mojarra version I have, and how do I upgrade it? I'm using NetBeans 7.1.2. – Carlos Vergara Aug 05 '12 at 02:07
  • Read the server startup log. Mojarra prints the version information as an INFO near end of the startup. Apparently you didn't manually install Mojarra, but it is been provided by the application server (e.g. Glassfish). You'd need to upgrade it in the server end then instead of in the webapp itself. Netbeans is basically just an editor (like Notepad, only with a richer toolset) and is therefore irrelevant to the problem. Telling about Netbeans this way is however a strong hint that you're indeed *actually* using Glassfish. Upgrading JSF can be done by replacing the JAR in `/glassfish/modules`. – BalusC Aug 05 '12 at 02:48
  • I'm not using GlassFish sadly, I'm using Tomcat and I cannot find a way to update Mojarra in Tomcat. But well, given that, apparently I can't do much since I'll have to deploy this later in another server. So do I just ignore the warning which apparently is false? – Carlos Vergara Aug 05 '12 at 02:52
  • Tomcat as being a barebones JSP/Servlet container doesn't ship with JSF at all. So you (or maybe Netbeans?) should surely have placed it yourself in the webapp's `/WEB-INF/lib`. Just replace the JAR(s) in there. – BalusC Aug 05 '12 at 03:26
  • That's weird, I've been working with Tomcat and JSF all this time with no issues at all. Weirder is that I don't see Mojarra anywhere in my /lib/ folder (unless the Mojarra files are jsf-api.jar and jsf-impl.jar - in which case I do see them). – Carlos Vergara Aug 05 '12 at 03:32
  • Yes, that are them. Before version 2.1.6 Mojarra was composed of exactly those two JAR files (see also this [related question](http://stackoverflow.com/questions/11145868/libraries-for-jsf-sun-oracle-mojarra)). Remove them and replace by the new single `javax.faces.jar` file of 2.1.11. – BalusC Aug 05 '12 at 03:32