1 Reply Latest reply on Jan 30, 2009 6:25 AM by Nick Belaevski

    <h:inputText> won't update domain values if it's in <a4j:rep

    Kent Tong Newbie


      Below is some simple code showing the problem. A list of items are displayed using a <a4j:repeat>. Each item has a name (string). It will display its name and allow the user to set it using an <h:inputText> and a <a4j:commandButton>. However, even though the action method will be called, the setter is never called. Any idea? Thanks!

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      <title>Insert title here</title>
      <a4j:repeat value="#{foo.list}" var="item">
       <h:outputText id="n" value="#{item.name}" />
       <h:inputText value="#{item.name}" />
       <a4j:commandButton action="#{item.action}" reRender="n" />
      package test;
      import java.util.ArrayList;
      import java.util.List;
      import javax.webbeans.Named;
      import javax.webbeans.SessionScoped;
      public class Foo {
       private List<Item> list;
       public Foo() {
       list = new ArrayList<Item>();
       list.add(new Item());
       list.add(new Item());
       list.add(new Item());
       public List<Item> getList() {
       return list;
      public class Item {
       private String name = "Hi";
       public String action() {
       System.out.println("action called");
       return null;
       public String getName() {
       return name;
       public void setName(String name) {
       System.out.println("setter called");
       this.name = name;