1
對於一個巨大的項目,我需要在網頁上構建多個表單。不能進入細節,但假定具有所要求的表格列表結構;使用鑽嘴魚科JSF 2.2.5h:ui內部形式:重複不能按預期工作
給定的託管Bean:
@ManagedBean
@SessionScoped
public class Debug {
private final List<DebugBean> list;
public Debug() {
super();
this.list = new ArrayList<DebugBean>();
this.list.add(new DebugBean("label 1", "value 1"));
this.list.add(new DebugBean("label 2", "value 2"));
}
public String submit() {
LOGGER.info("list = " + this.list.toString());
return "";
}
public List<DebugBean> getList() {
return this.list;
}
}
的豆DebugBean很簡單,只包含兩個變量標籤和值,這兩個字符串,它的setter和getter。
現在XHTML頁面:
<h:body style="height: 100%">
<ui:repeat value="#{debug.list}" var="x">
<h:form>
<h:panelGrid columns="2">
<h:outputText value="#{x.label}" />
<h:inputTextarea value="#{x.value}" />
</h:panelGrid>
<h:commandButton action="#{debug.submit}" value="ok" />
</h:form>
</ui:repeat>
</h:body>
的問題是在不斷變化的第一個值。當我更改第二個時,記錄器會按預期給我提供新值。但改變第一個,記錄器給我的舊名單,好像我會重新加載完整的形式沒有任何改變。這裏有什麼問題,更重要的是:我能做些什麼來使它工作?