我的工作是:
- 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>而豆码是:
@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标记中,则该代码将无法工作。这是代码片段:
<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的一部分。所以我有两个问题:
发布于 2012-11-29 06:23:30
1)因为默认情况下,popupPanel显示在<body>元素中
2)将domElementAttachment="form"添加到rich:popupPanel应该会有所帮助
https://stackoverflow.com/questions/13618500
复制相似问题