primefaces 通过selectOneMenu更新显示隐藏区域

最重要的是update的区域要指定整个panel,而不是想更新的那个组件

<h:form id="frm">
<h:panelGrid id="panelgrid">
<p:panel id="panel" >
<h:outputLabel value="Name: " for="name" />
<p:inputText id="name" value="#{userBean.name}" immediate="true" onkeypress="#{userBean.showName}"> <p:ajax event="change" update="frm:panelgrid" listener="#{userBean.inputcangeeListener}" />
</p:inputText>
</p:panel> <p:panel id="p2" rendered="#{userBean.displayName}">
<p:selectOneRadio id="city" value="#{userBean.city}" layout="grid" columns="3">
<f:selectItems value="#{userBean.cities}" var="c" itemLabel="#{city}" itemValue="#{city}" />
</p:selectOneRadio>
</p:panel> </h:panelGrid>
</h:form>

And my managed bean looks like-

    @PostConstruct
public void init() {
displayName = false;
} public boolean isShowName(){
return displayName;
} public void inputcangeeListener(javax.faces.event.AjaxBehaviorEvent changeEvent){
setDisplayName(true);
cities = new ArrayList<>();
cities.add("pune");
cities.add("KOL"); }
上一篇:/usr/libexec/urlgrabber-ext-down /usr/bin/yum


下一篇:【luogu P3275 [SCOI2011]糖果】 题解