0
Jdev版本:11.1.1.7綁定動態生成組件
我從Java bean創建數據控件。我使用數據控件屬性綁定jspx頁面。
在該頁面中,我動態創建了組件(forEach循環)。
問題是組件只創建(遞增),但綁定值沒有不同。
代碼:
豆:
public class ProposalBean
{
private String name;
private String age;
public ProposalBean()
{
super();
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setAge(String age)
{
this.age = age;
}
public String getAge()
{
return age;
}
}
JSPX:
<af:form id="f1">
<af:panelGroupLayout id="pgl1">
<af:panelTabbed id="pt1">
<af:forEach var="var" varStatus="vs" begin="1" end="3">
<af:showDetailItem text="Tab #{vs.index}" id="sdi1">
<af:inputText value="#{bindings.name.inputValue}"
label="#{bindings.name.hints.label}"
required="#{bindings.name.hints.mandatory}"
columns="#{bindings.name.hints.displayWidth}"
maximumLength="#{bindings.name.hints.precision}"
shortDesc="#{bindings.name.hints.tooltip}"
id="it1">
<f:validator binding="#{bindings.name.validator}"/>
</af:inputText>
<af:inputText value="#{bindings.age.inputValue}"
label="#{bindings.age.hints.label}"
required="#{bindings.age.hints.mandatory}"
columns="#{bindings.age.hints.displayWidth}"
maximumLength="#{bindings.age.hints.precision}"
shortDesc="#{bindings.age.hints.tooltip}"
id="it2">
<f:validator binding="#{bindings.age.validator}"/>
</af:inputText>
</af:showDetailItem>
</af:forEach>
</af:panelTabbed>
<af:commandButton text="submit" id="cb1" action="next"/>
</af:panelGroupLayout>
</af:form>
注:在forEach循環到底是動態的。
作爲@Nagh說你缺少你的forEach嚴重的屬性,它是項目屬性,它應該指向你的迭代器綁定 –