mst*_*nbe 2 facelets composite-component jsf-2 uirepeat
我与Mojarra 2.1.3合作.
当用户点击"刷新不工作"按钮时,它会刷新ui:repeat的内容.我希望检查复选框,就像在初始化时一样.
我发现:如果我删除h:head in facelet"刷新不工作"的作品...有什么想法吗?
小脸:
<h:head></h:head>
<h:body>
<h:form id="myForm" >
<h:panelGroup id="panelToRefreshOutsideRepeat">
<ui:repeat value="#{sandbox.columns}" var="column">
<h:panelGroup id="panelToRefreshInsideRepeat">
<h2>composite onlyCheckbox:</h2>
<trc:onlyCheckbox value="#{column.value}" />
<br />
<h2>composite onlyInputText:</h2>
<trc:onlyInputText value="#{column.value}" />
<br />
<br/>
<h:commandButton value="Refresh don't work" >
<f:ajax render="panelToRefreshInsideRepeat" />
</h:commandButton>
<h:commandButton value="Refresh work" >
<f:ajax render=":myForm:panelToRefreshOutsideRepeat" />
</h:commandButton>
</h:panelGroup>
<br/>
</ui:repeat>
</h:panelGroup>
Run Code Online (Sandbox Code Playgroud)
onlyCheckbox和onlyInputText的复合:
<composite:interface>
<composite:attribute name="value"
type="boolean"/>
</composite:interface>
<composite:implementation>
boolean: <h:selectBooleanCheckbox value="#{cc.attrs.value}" />
<!-- for onlyInputText h:inputText instead of h:selectBooleanCheckbox -->
boolean value: #{cc.attrs.value}
</composite:implementation>
Run Code Online (Sandbox Code Playgroud)
和支持bean:
@ManagedBean
@RequestScoped
public class Sandbox {
public List<Column> columns = Arrays.asList(new Column(true));
public List<Column> getColumns() {
return columns;
}
public void setColumns(List<Column> columns) {
this.columns = columns;
}
public class Column {
private boolean value;
public Column(boolean value) {
this.value = value;
}
public void setValue(boolean value) {
this.value = value;
}
public boolean getValue() {
return this.value;
}
}
}
Run Code Online (Sandbox Code Playgroud)
即使是最新的Mojarra 2.1.4,我也可以重现你的问题.如果复选框不在复合内,它可以正常工作.这是Mojarra的一个错误<ui:repeat>.它完全打破在钻嘴鱼科.它在MyFaces 2.1.3上完美运行.
你有2个选择:
UIData组件,而不是<ui:repeat>,例如<h:dataTable>,<t:dataList>,<p:dataList>等.| 归档时间: |
|
| 查看次数: |
1297 次 |
| 最近记录: |