Question

I have a List of strings in my object, and I was hoping to be able to edit them with an a4j:repeat.

Below is my code:

<a4j:repeat value="#{Controller.object.stringList}"  var="item" >
<h:panelGrid columns="2">
<h:outputLabel value="ID:" />
<h:inputText  value="#{item}" />
</h:panelGrid>
</a4j:repeat>

My problem is that the values of the items never get changed when I submit my form. I've had a look at the livedemo but even after adding the UpdateBean, it still didn't work.

Any ideas?

Was it helpful?

Solution

The objects in your repeat need to follow the bean standard if you want to write back to them. I'm guessing that they are just Strings in your example?

Try this:

public class StringBean {
  private String value;

  public void setValue(String value) {
    this.value = value;
  }

  public String getValue() {
    return value;
  }
}

along with:

<h:inputText value=#{item.value} />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top