【发布时间】:2012-11-17 02:19:18
【问题描述】:
我正在合作:
- RichFaces 4.2.2
- Mojarra 2.1.14
让我们看看下面的简单代码:
<h:form>
<h:selectOneRadio value="#{testBean.option}" >
<f:selectItem itemValue="0" itemLabel="Option 0"/>
<f:selectItem itemValue="1" itemLabel="Option 1"/>
<f:ajax execute="@this" render="infoPanelId"/>
</h:selectOneRadio>
<a4j:outputPanel id="infoPanelId">
<h:outputText value="Option 0 selected" rendered="#{testBean.option == '0'}"/>
<h:outputText value="Option 1 selected" rendered="#{testBean.option == '1'}"/>
</a4j:outputPanel>
</h:form>
和 bean 代码:
@ManagedBean(name="testBean")
@ViewScoped
public class TestBean implements Serializable{
private String option;
public String getOption() {
return option;
}
public void setOption(String option) {
this.option = option;
}
}
它工作得很好,而且很简单。重新渲染按预期工作。 但是如果我们把这个简单的代码放在 rich:popupPanel 标记中,那段代码就不起作用了。 这是代码sn-p:
<h:form>
<a4j:commandButton
value="show popup"
oncomplete="#{rich:component('testPopup')}.show()"
render="testPopup"
/>
<rich:popupPanel id="testPopup" modal="false" autosized="true" resizable="false">
<f:facet name="header">
<h:outputText value="popup"/>
</f:facet>
<h:panelGrid columns="1">
<h:selectOneRadio value="#{testBean.option}" >
<f:selectItem itemValue="0" itemLabel="Option 0"/>
<f:selectItem itemValue="1" itemLabel="Option 1"/>
<f:ajax execute="@this" render="infoPanelId"/>
</h:selectOneRadio>
<a4j:outputPanel id="infoPanelId">
<h:outputText value="Option 0 selected" rendered="#{testBean.option == '0'}"/>
<h:outputText value="Option 1 selected" rendered="#{testBean.option == '1'}"/>
</a4j:outputPanel>
</h:panelGrid>
</rich:popupPanel>
</h:form>
所以popupPanel里面的代码不起作用。我无法重新渲染 popupPanel 的一部分。所以我有两个问题:
- 为什么?
- 我怎样才能让它工作?
【问题讨论】:
标签: jsf jsf-2 richfaces rerender popuppanel