6 Replies Latest reply on Feb 13, 2008 5:33 AM by s c

    Ajax4JSF not Rendering at all

    s c Newbie


      My environment is Netbeans 6 visual web JSF app with RichFaces 3.1.3. I am unable to get any component to rerender upon completion of an ajax request. Is there something wrong in the logic i am following or is it a configuration issue or is it a bug? I will be grateful for any help in this regard. Thank you.

      A snippet of the code i am using:


      <jsp:root version="2.1" xmlns:a4j="http://richfaces.org/a4j" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
       xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:rich="http://richfaces.org/rich" xmlns:webuijsf="http://www.sun.com/webui/webuijsf">
       <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
       <webuijsf:page binding="#{AboutUs.page1}" id="page1">
       <webuijsf:html binding="#{AboutUs.html1}" id="html1">
       <webuijsf:head binding="#{AboutUs.head1}" id="head1">
       <webuijsf:link binding="#{AboutUs.link1}" id="link1" url="/resources/stylesheet.css"/>
       <webuijsf:body binding="#{AboutUs.body1}" id="body1" style="-rave-layout: grid">
       <webuijsf:form binding="#{AboutUs.form1}" id="form1">
       <webuijsf:image binding="#{AboutUs.image1}" height="2" id="image1"
       style="background-repeat: repeat-x; left: 6px; top: 493px; position: absolute" url="/resources/pic/blue_lt_gradient.gif" width="948"/>
       <webuijsf:textField binding="#{AboutUs.textField1}" id="textField1"
       style="position: absolute; left: 174px; top: 72px; width: 228px; height: 18px" valueChangeListenerExpression="#{AboutUs.textField1_processValueChange}">
       <a4j:support action="#{AboutUs.textField1_action}" event="onChange" reRender="textField1"/>
       <webuijsf:textField binding="#{AboutUs.textField2}" id="textField2" style="position: absolute;left: 174px; top: 132px; width: 132px; height: 24px">
       <a4j:support action="#{AboutUs.textField1_action}" event="onChange" reRender="textField1"/>

      The Backing Bean function:

       public String textField1_action() {
       this.getTextField1().setText("Hello World!");
       return null;

        • 1. Re: Ajax4JSF not Rendering at all
          Viggo Navarsete Expert

          what is it that you want to accomplish? When you enter text into textField1, you want it to display "Hello World" in the textField1? And when you enter something into textField2, what should then happen?

          I'm a little bit confused about what you try to do! Please tell us more about your requirements, and then perhaps we can find a solution to you :)

          • 2. Re: Ajax4JSF not Rendering at all
            s c Newbie

            Sorry for having caused confusion. In the JSP code provided in the first post - the a4j:support tag line should be deleted from textField1.

            All i am trying to do is the following:
            1. Raise an Ajax event in one component through a change in its value
            2. Get the backing bean function to be called where another component's value is changed (This component is set to be reRendered in the first component's a4j:support tag)
            3. See the change that has taken place.

            I am unable to see the 3rd step happen with any component that i have tried. I have so far tried it with listboxes and textboxes.

            My original requirement is as follows - I have a couple of listboxes. The first listbox displays a list of items. When the user clicks on any one of the items, an ajax event is fired and i perform a database query based on the selected item and populate the second listbox with its results. However, upon completion the second listbox wasn't showing the new values. It remained unchanged.

            That is when i decided to test the concept on something simpler - two textboxes. A change in one raises an ajax event which modifies the value of the second textbox. However, the second textbox also remains unchanged.

            I have verified that the event is being raised in each of the cases and the function is completing successfully. However, for some reason, i am not being able to see the new values in the second components. i.e. they are remaining unchanged.

            Looking forward to your help.


            • 3. Re: Ajax4JSF not Rendering at all
              Ilya Shaikovsky Master

              check pelase this http://labs.jboss.com/wiki/RichFacesTwoInputText

              Looks like it's a source of your problem.

              • 4. Re: Ajax4JSF not Rendering at all
                s c Newbie


                I checked out the article. However, none of the suggested workarounds worked. So, i dont think that it is a renderer implementation fault.

                Any other idea as to why this might be happening and what can be done to make it work?

                • 5. Re: Ajax4JSF not Rendering at all
                  Viggo Navarsete Expert

                  schinni: Which version of Richfaces are you using? I'm done somewhat the same as you want to accompish with version 3.1.3.GA, which I think is a more robust and bug-free release than the newer releases.
                  I'm not sure, but could you try to replace the binding attribute at each textfield with value instead?
                  What scope do you have on your backing bean?

                  • 6. Re: Ajax4JSF not Rendering at all
                    s c Newbie

                    I am using RichFaces 3.1.3 GA.

                    I tried changing the Binding attribute to value. However, an exception was thrown -> "Attribute value invalid for tag textField according to TLD"

                    I have tried my backing bean with both request scope as well as session scope.

                    Unfortunately, It still does not work...