2 Replies Latest reply on Dec 18, 2008 11:53 AM by Anton Kudinov

    a4j:support and rerender gridPanel problem

    Anton Kudinov Newbie

      JSF page:

      <%@page contentType="text/html"%>
      <%@page pageEncoding="UTF-8"%>
      
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
      
      
      <html>
      <body>
      <f:view>
       <h:form id="arrival" prependId="false">
       <rich:tabPanel>
       <rich:tab label="Tab 1" id="idtab">
       </rich:tab>
      
       <rich:tab label="Tab2" id="regtab">
       <rich:panel>
       <a4j:log hotkey="M" />
       <h:outputLabel value="Type" />
      
       <h:selectOneMenu value="#{test.hostSideType}"
       id="selectHostSideType" required="true">
       <f:selectItems id="hosttypes" value="#{test.hostSideTypes}" />
       <a4j:support event="onchange"
       actionListener="#{test.changeHostSideType}"
       reRender="hostOrgGridR,selectHostSideType" ajaxSingle="true"
       limitToList="true" />
       </h:selectOneMenu>
      
       <h:panelGrid id="hostOrgGridR" columns="1">
       <h:panelGrid id="hostOrgGrid" columns="2"
       rendered="#{test.showOrganization}">
       <h:outputText value="#{test.hostSideType}" />
       </h:panelGrid>
       </h:panelGrid>
       </rich:panel>
       </rich:tab>
       </rich:tabPanel>
       <h:commandButton id="saveButton" type="submit" />
       </h:form>
      </f:view>
      </body>
      </html>



      Java Bean

      package ru.test;
      
      import java.util.ArrayList;
      import java.util.Collection;
      
      import javax.faces.event.ActionEvent;
      import javax.faces.model.SelectItem;
      
      public class BackingBean {
       private int hostSideType = 1;
       private boolean showOrganization;
      
       public Collection<SelectItem> getHostSideTypes(){
       Collection<SelectItem> result = new ArrayList<SelectItem>();
       result.add(new SelectItem(0, "T1"));
       result.add(new SelectItem(1, "T2"));
       return result;
       }
       public int getHostSideType() {
       return hostSideType;
       }
       public void setHostSideType(int hostSideType) {
       this.hostSideType = hostSideType;
       }
       public void changeHostSideType(ActionEvent event) {
       showOrganization = (hostSideType == 0);
       }
       public boolean isShowOrganization() {
       return showOrganization;
       }
       public void setShowOrganization(boolean showOrganization) {
       this.showOrganization = showOrganization;
       }
      }



      faces-confix.xml :

      <managed-bean>
       <managed-bean-name>test</managed-bean-name>
       <managed-bean-class>ru.test.BackingBean</managed-bean-class>
       <managed-bean-scope>session</managed-bean-scope>
       </managed-bean>



      web.xml:

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
       <context-param>
       <param-name>org.richfaces.SKIN</param-name>
       <param-value>blueSky</param-value>
       </context-param>
       <context-param>
       <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
       <param-value>.jsp</param-value>
       </context-param>
       <filter>
       <display-name>RichFaces Filter</display-name>
       <filter-name>richfaces</filter-name>
       <filter-class>org.ajax4jsf.Filter</filter-class>
       </filter>
       <filter-mapping>
       <filter-name>richfaces</filter-name>
       <servlet-name>Faces Servlet</servlet-name>
       <dispatcher>REQUEST</dispatcher>
       <dispatcher>FORWARD</dispatcher>
       <dispatcher>INCLUDE</dispatcher>
       </filter-mapping>
      
       <servlet>
       <servlet-name>Faces Servlet</servlet-name>
       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
       <servlet-mapping>
       <servlet-name>Faces Servlet</servlet-name>
       <url-pattern>*.jsf</url-pattern>
       </servlet-mapping>
       <welcome-file-list>
       <welcome-file>index.html</welcome-file>
       </welcome-file-list>
       <login-config>
       <auth-method>BASIC</auth-method>
       </login-config>
      </web-app>
      


      Situation:

      1. Go to second tab
      2. Switch �ombobox value on T1 - we must see "0" on page
      3. Go to first tab.
      4. Back to second tab.
      5. Switch �ombobox value on T1 - we see "0" on page

      it is a bug or not ?
      what i can do for this code work normal.

      thank you