6 Replies Latest reply on Dec 12, 2007 11:13 AM by Stan Silvert

    No parameter named 'productForm:newIp' is defined in the for

    Blondel Michaël Newbie


      I have an <h:inputText> which is not rendered in my page.
      When I use the function ajaxSubmit, this input is now rendered.
      But I can't use client.setParameter. I have this error :

      No parameter named 'productForm:newIp' is defined in the form

        • 1. Re: No parameter named 'productForm:newIp' is defined in the
          Stan Silvert Master

          Does the Ajax request cause navigation to a new view? If yes, it's probably a bug in JSFUnit.

          If not, I would normally still assume that this was a bug in JSFUnit, but I think the problem might be in RichFaces. I think what is happening is that RichFaces is failing to update the component tree of the view.

          You can use this static method to print the component tree to standard out and see if the client ID is in the tree:


          I probably won't be able to take a closer look until I get home from Javapolis.


          • 2. Re: No parameter named 'productForm:newIp' is defined in the
            Blondel Michaël Newbie

            Ajax request causes no new navigation (no new view). I stay on the same page.

            before the ajax submit the inputText is found but not rendered.
            after the Ajax submit, the inputText is now rendered.

            UIComponent prompt = server.findComponent("form:toto");

            But the webForm is certainly not updated because it is impossible to do this :

            client.setParameter("form:toto", "titi");

            Thanks for your help

            • 3. Re: No parameter named 'productForm:newIp' is defined in the
              Stan Silvert Master

              So if I understand, before the Ajax request, the component exists in the component tree but is not rendered. After the Ajax request, rendered == true. Correct?

              Can you do the dumpComponentTree before and after to verify?



              • 4. Re: No parameter named 'productForm:newIp' is defined in the
                Blondel Michaël Newbie

                yes the component exists in the component tree before the Ajax Request

                JSFClientSession client = ExaWizardNavigationUtils.getStep1JsfClientSession();
                JSFServerSession server = new JSFServerSession(client);
                UIComponent toto = server.findComponent("form:toto");
                assertFalse(toto.isRendered()); // Not rendered
                FacesContext facesContext = FacesContextBridge.getCurrentInstance();
                //component exists
                RichFacesClient richClient = new RichFacesClient(client);
                client.setParameter("form:product", "productValue");
                assertEquals("productValue", server.getManagedBeanValue("#{bean.product}"));
                toto = server.findComponent("form:toto");
                assertTrue(toto.isRendered()); // rendered
                client.setParameter("form:toto", "totoValue"); // ERREUR !!!!!

                the product field in my jsp is an rich:suggestionbox

                <h:inputText value="#{bean.product}" size="50" id="product" >
                 <a4j:support id="a4jsupport"/>
                <rich:suggestionbox for="product"
                 suggestionAction="#{bean.getProducts}" var="result"
                 width="200" height="150" minChars="0">
                 <h:outputText value="#{result.productName}" />
                 <a4j:support event="onselect" reRender="toto" />
                <h:inputText id="toto" rendered="#{! empty bean.product}"/>

                • 5. Re: No parameter named 'productForm:newIp' is defined in the
                  Stan Silvert Master

                  Thanks. I think I know the problem now. I don't think I will be able to fix it until next week when I get home.



                  • 6. Re: No parameter named 'productForm:newIp' is defined in the
                    Stan Silvert Master

                    I tried to recreate your problem, but I found that this actually looks like a quirk in RichFaces. To get RichFaces to display a once-unrendered component, you need to surround it with <a4j:outputPanel>.

                    For instance, the following code will conditionally display rep or foo based on the value of #{textbean.text}

                    <h:inputText id="input_text" size="50" value="#{textbean.text}" >
                     <a4j:support id="a4jsupport" event="onkeyup" reRender="nonfooregion,fooregion"/>
                     <a4j:outputPanel id="nonfooregion">
                     <h:outputText value="#{textbean.text}" id="rep" rendered="#{'foo' != textbean.text}"/>
                     <a4j:outputPanel id="fooregion">
                     <h:inputText value="Text is 'foo' !!!!" id="foo" rendered="#{'foo' == textbean.text}"/>

                    You have to rerender the outputPanel which is always rendered. Otherwise, RichFaces doesn't know where to put the newly displayed component.

                    The following JSFUnit code works for this:
                    JSFClientSession client = new JSFClientSession("/pages/echo.jsf");
                     Ajax4jsfClient ajaxClient = new Ajax4jsfClient(client);
                     client.setParameter("input_text", "foo");
                     client.setParameter("foo", "I set it OK");

                    Does that solve your problem?