3 Replies Latest reply on Oct 7, 2010 5:11 AM by mszalay

    A4j:support reRender problem

    mszalay

      Hi all

       

      I have a jsp page containing three dropdowns. The second dropdown should only appear if there was a value in the first one select

      and the third one only if there was a value in the second selected...and so on.

       

      The problem is, that the A4j call does not work on a component which rendering state changed from "false" to "true" with ajax.

      There is the following warn output in the a4j log:

       

      No information in response about elements to replace

       

      ..and nothing gets rerendered.

      On components appearing without ajax from the beginning of the request, it works.

      I'm running RichFaces  3.2.2.GA and Mojarra 1.2_02 on Glassfish 2.1.

       

      Code of the jsp:

       

      <%@ page contentType="text/html"%>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="core" %>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="html" %>
      <%@ taglib uri="http://richfaces.org/rich"    prefix="rich" %>
      <%@ taglib uri="http://richfaces.org/a4j"     prefix="a4j"  %>
      <core:loadBundle var="Home" basename="Home" />
      <core:loadBundle var="View" basename="View" />
      <core:view>
          <html:outputText value="#{viewSidebarDecorator.updateSidebar}" />
          <%@ include file="../WEB-INF/jspf/header.jspf" %>
          <html:form id="configureSortingForm">
              <rich:panel id="sortingPanel" style="height: 100%; vertical-align: top;">
                  <core:facet name="header">
                      <html:outputText value="#{View.configureSortingTitle}" />
                  </core:facet>
                  <html:panelGrid columns="4">
                      <%-- first sort key --%>
                      <html:outputLabel styleClass="title" value="#{View.firstSortKeyName}" />
                      <html:selectOneMenu id="firstSortKey" value="#{viewSortingConfigurator.firstSortKey}">
                          <core:selectItems value="#{viewSortingConfigurator.firstSortKeyItems}" />
                          <a4j:support event="onchange" reRender="configureSortingForm" />
                      </html:selectOneMenu>
                      <html:selectOneMenu value="#{viewSortingConfigurator.firstSortKeyOrder}"
                                          rendered="#{viewSortingConfigurator.firstSortKeySelected}"
                                          required="true">
                          <core:selectItems value="#{viewSortingConfigurator.orderItems}" />
                          <a4j:support event="onchange" reRender="configureSortingForm" />
                      </html:selectOneMenu>
                      <html:message for="firstSortKey" styleClass="error" />
                      <%-- second sort key --%>
                      <html:outputLabel styleClass="title" value="#{View.secondSortKeyName}"
                                        rendered="#{viewSortingConfigurator.firstSortKeySelected}"/>
                      <html:selectOneMenu id="secondSortKey" value="#{viewSortingConfigurator.secondSortKey}"
                                          rendered="#{viewSortingConfigurator.firstSortKeySelected}">
                          <core:selectItems value="#{viewSortingConfigurator.secondSortKeyItems}" />
                          <a4j:support event="onchange" reRender="configureSortingForm" />
                      </html:selectOneMenu>
                      <html:selectOneMenu value="#{viewSortingConfigurator.secondSortKeyOrder}"
                                          rendered="#{viewSortingConfigurator.secondSortKeySelected}"
                                          required="true">
                          <core:selectItems value="#{viewSortingConfigurator.orderItems}" />
                          <a4j:support event="onchange" reRender="configureSortingForm" />
                      </html:selectOneMenu>
                      <html:message for="secondSortKey" styleClass="error" rendered="#{viewSortingConfigurator.firstSortKeySelected}" />
                      <%-- third sort key --%>
                      <html:outputLabel styleClass="title" value="#{View.thirdSortKeyName}"
                                        rendered="#{viewSortingConfigurator.secondSortKeySelected}" />
                      <html:selectOneMenu id="thirdSortKey" value="#{viewSortingConfigurator.thirdSortKey}"
                                          rendered="#{viewSortingConfigurator.secondSortKeySelected}">
                          <core:selectItems value="#{viewSortingConfigurator.thirdSortKeyItems}" />
                          <a4j:support event="onchange" reRender="configureSortingForm" />
                      </html:selectOneMenu>
                      <html:selectOneMenu value="#{viewSortingConfigurator.thirdSortKeyOrder}"
                                          rendered="#{viewSortingConfigurator.thirdSortKeySelected}">
                          <core:selectItems value="#{viewSortingConfigurator.orderItems}" />
                          <a4j:support event="onchange" reRender="configureSortingForm" />
                      </html:selectOneMenu>
                      <html:message for="thirdSortKey" styleClass="error" rendered="#{viewSortingConfigurator.secondSortKeySelected}" />
                  </html:panelGrid>
                  <%-- buttons --%>
                  <html:panelGrid columns="2">
                      <html:commandButton value="#{View.buttonApplySorting}"
                                          action="#{viewSortingConfigurator.save}"
                                          styleClass="button" />
                      <html:commandButton value="#{View.buttonCancel}"
                                          action="#{viewSortingConfigurator.cancel}"
                                          immediate="true"
                                          styleClass="button" />
                  </html:panelGrid>
              </rich:panel>
          </html:form>
          <a4j:log level="WARN" popup="false" width="400" height="200"/>
          <%@ include file="../WEB-INF/jspf/footer.jspf" %>
      </core:view>

      <%@ page contentType="text/html"%>

      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="core" %>

      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="html" %>

      <%@ taglib uri="http://richfaces.org/rich"    prefix="rich" %>

      <%@ taglib uri="http://richfaces.org/a4j"     prefix="a4j"  %>


      <core:loadBundle var="Home" basename="Home" />

      <core:loadBundle var="View" basename="View" />

      <core:view>

          <html:outputText value="#{viewSidebarDecorator.updateSidebar}" />


          <%@ include file="../WEB-INF/jspf/header.jspf" %>


          <html:form id="configureSortingForm">

              <rich:panel id="sortingPanel" style="height: 100%; vertical-align: top;">

                  <core:facet name="header">

                      <html:outputText value="#{View.configureSortingTitle}" />

                  </core:facet>


                  <html:panelGrid columns="4">


                      <%-- first sort key --%>

                      <html:outputLabel styleClass="title" value="#{View.firstSortKeyName}" />

                      <html:selectOneMenu id="firstSortKey" value="#{viewSortingConfigurator.firstSortKey}">

                          <core:selectItems value="#{viewSortingConfigurator.firstSortKeyItems}" />

                          <a4j:support event="onchange" reRender="configureSortingForm" />

                      </html:selectOneMenu>

                      <html:selectOneMenu value="#{viewSortingConfigurator.firstSortKeyOrder}"

                                          rendered="#{viewSortingConfigurator.firstSortKeySelected}"

                                          required="true">

                          <core:selectItems value="#{viewSortingConfigurator.orderItems}" />

                          <a4j:support event="onchange" reRender="configureSortingForm" />

                      </html:selectOneMenu>

                      <html:message for="firstSortKey" styleClass="error" />


                      <%-- second sort key --%>

                      <html:outputLabel styleClass="title" value="#{View.secondSortKeyName}"

                                        rendered="#{viewSortingConfigurator.firstSortKeySelected}"/>

                      <html:selectOneMenu id="secondSortKey" value="#{viewSortingConfigurator.secondSortKey}"

                                          rendered="#{viewSortingConfigurator.firstSortKeySelected}">

                          <core:selectItems value="#{viewSortingConfigurator.secondSortKeyItems}" />

                          <a4j:support event="onchange" reRender="configureSortingForm" />

                      </html:selectOneMenu>

                      <html:selectOneMenu value="#{viewSortingConfigurator.secondSortKeyOrder}"

                                          rendered="#{viewSortingConfigurator.secondSortKeySelected}"

                                          required="true">

                          <core:selectItems value="#{viewSortingConfigurator.orderItems}" />

                          <a4j:support event="onchange" reRender="configureSortingForm" />

                      </html:selectOneMenu>

                      <html:message for="secondSortKey" styleClass="error" rendered="#{viewSortingConfigurator.firstSortKeySelected}" />


                      <%-- third sort key --%>

                      <html:outputLabel styleClass="title" value="#{View.thirdSortKeyName}"

                                        rendered="#{viewSortingConfigurator.secondSortKeySelected}" />

                      <html:selectOneMenu id="thirdSortKey" value="#{viewSortingConfigurator.thirdSortKey}"

                                          rendered="#{viewSortingConfigurator.secondSortKeySelected}">

                          <core:selectItems value="#{viewSortingConfigurator.thirdSortKeyItems}" />

                          <a4j:support event="onchange" reRender="configureSortingForm" />

                      </html:selectOneMenu>

                      <html:selectOneMenu value="#{viewSortingConfigurator.thirdSortKeyOrder}"

                                          rendered="#{viewSortingConfigurator.thirdSortKeySelected}">

                          <core:selectItems value="#{viewSortingConfigurator.orderItems}" />

                          <a4j:support event="onchange" reRender="configureSortingForm" />

                      </html:selectOneMenu>

                      <html:message for="thirdSortKey" styleClass="error" rendered="#{viewSortingConfigurator.secondSortKeySelected}" />


                  </html:panelGrid>


                  <%-- buttons --%>

                  <html:panelGrid columns="2">

                      <html:commandButton value="#{View.buttonApplySorting}"

                                          action="#{viewSortingConfigurator.save}"

                                          styleClass="button" />

                      <html:commandButton value="#{View.buttonCancel}"

                                          action="#{viewSortingConfigurator.cancel}"

                                          immediate="true"

                                          styleClass="button" />

                  </html:panelGrid>

              </rich:panel>

          </html:form>


          <a4j:log level="WARN" popup="false" width="400" height="200"/>


          <%@ include file="../WEB-INF/jspf/footer.jspf" %>


      </core:view>