开发者

h:inputText inside a4j:repeat

开发者 https://www.devze.com 2022-12-11 01:26 出处:网络
I have a List of strings in my object, and I was hoping to be able to edit them with 开发者_如何学Goan a4j:repeat.

I have a List of strings in my object, and I was hoping to be able to edit them with 开发者_如何学Goan 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?


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} />
0

精彩评论

暂无评论...
验证码 换一张
取 消