Uploaded image for project: 'RichFaces'
  1. RichFaces
  2. RF-13963

a4j calls and repeatable components

    XMLWordPrintable

    Details

      Description

      In the following example, the value of the repeatable component is evaluated when clicking the button although the parent Container of this component is not rendered.
      The expected behaviour should be this value not being evaluated during the ajax request.

      The evaluation of the value doesn't occur in the following cases :

      • if you replace the ui:repeat by a h:dataTable
      • or if you replace the a4j:commandButton by a h:commandButton with f:ajax capabilities
      • or if you put the a4j:commandbButton above the non rendered panelGroup

      The evaluation of the value still occurs in the following cases :

      • if you replace the ui:repeat by a a4j:repeat or a rich:dataTable
      • or if you replace the a4j:commandButton by a a4j:commandLink

      hidden_repeat.xhtml

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
            xmlns:rich="http://richfaces.org/rich"
            xmlns:ui="http://java.sun.com/jsf/facelets"
            xmlns:f="http://java.sun.com/jsf/core"
            xmlns:a4j="http://richfaces.org/a4j"
            xmlns:h="http://java.sun.com/jsf/html">
      <h:head>
      	<title>Ajax with ui:repeat</title>	
      </h:head>
      <h:body>
       
      <h:form id="h1">
      	<h:panelGroup layout="block" rendered="false">
      		<ui:repeat id="dt2" value="#{hiddenRepeatBean.names}" var="n" >#{n}</ui:repeat>
      	</h:panelGroup>
      	<a4j:commandButton id="cl" value="ajax call" execute="@this" />
      </h:form>
      	
      </h:body>
      </html>
      

      HiddenRepeatBean.java

       
      import java.util.ArrayList;
      import java.util.List;
       
      import javax.faces.bean.ManagedBean;
      import javax.faces.bean.ViewScoped;
       
      import org.apache.commons.logging.Log;
      import org.apache.commons.logging.LogFactory;
       
      @ManagedBean
      @ViewScoped
      public class HiddenRepeatBean {
      	
      	private static final Log log = LogFactory.getLog(HiddenRepeatBean.class);
      	
      	private List<String> names;
      	
      	public HiddenRepeatBean() {
      	}
      	public String action() {
      		return null;
      	}
      	public List<String> getNames() {
      		log.info("getNames");
      		if (names == null) {
      			names = new ArrayList<String>();
      			names.add("Franck");
      			names.add("Christophe");
      			names.add("William");
      		}
      		return names;
      	}
       
      	public void setNames(List<String> names) {
      		this.names = names;
      	}
      }
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                michpetrov Michal Petrov
                Reporter:
                bluez974 Franck Gasparotto
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: