我的按钮代码是:
<h:commandButton value="Clean" action="#{facesBean.cleanFilter()}" >
<f:ajax execute="@form" render="result id name"/>
</h:commandButton>
我可以看到它调用了我的操作并且我的属性在后台是空的,但是我的表单输入没有被清理。它应该清理两个输入和一个表。桌子被清理了,但我的输入没有。
我已经搜索了一些没有运气的解决方案。
有什么不对?
我的弹出窗口有它自己的文件 popup.xhtml,我通过 ui:include 使用它。这是我的弹出代码:
<h:form id="userForm">
<rich:popupPanel id="popup-user" modal="true" headerClass="popup-header" styleClass="popup" domElementAttachment="form" keepVisualState="true" width="620" autosized="true" top="50">
<f:facet name="header" >
<h:outputText value="Search User" />
</f:facet>
<f:facet name="controls">
<h:commandLink>
<h:graphicImage url="/images/icon-close.png" alt="Close" styleClass="icone-close"/>
<rich:componentControl target="popup-user" operation="hide" />
</h:commandLink>
</f:facet>
<fieldset>
<legend class="section">Search User Filter</legend>
<h:panelGrid styleClass="form" columns="1" cellspacing="0" columnClasses="item">
<h:panelGroup>
<h:outputLabel styleClass="label-form" value="ID" for="id" />
<br />
<h:inputText id="id" value="#{facesBean.filter.id}" styleClass="textfield" maxlength="8"/>
</h:panelGroup>
<h:panelGroup>
<h:outputLabel styleClass="label-form" value="Name" for="name" />
<br />
<h:inputText id="name" value="#{facesBean.filter.name}" styleClass="textfield" />
</h:panelGroup>
</h:panelGrid>
</fieldset>
<div id="buttons">
<h:commandButton value="Search" action="#{facesBean.search()}">
<f:ajax execute="@form" render="result-users" />
</h:commandButton>
<h:commandButton value="Clean" action="#{facesBean.clean()}" >
<f:ajax execute="@form" render="id name result-user"/>
</h:commandButton>
</div>
<h:panelGroup id="result-user">
<rich:dataScroller for="userTable" styleClass="pagination" maxPages="5" boundaryControls="hide" renderIfSinglePage="false" fastControls="hide" stepControls="auto" execute="@form" render="userTable" />
<rich:dataTable id="userTable" value="#{facesBean.list}" var="user" style="width:600px;" rows="10">
<f:facet name="header">
<rich:columnGroup>
<rich:column styleClass="left" style="width: 5%">
<h:outputText value="Action" />
</rich:column>
<rich:column styleClass="left" style="width: 10%">
<h:outputText value="ID" />
</rich:column>
<rich:column styleClass="left" style="width: 25%">
<h:outputText value="Name" />
</rich:column>
<rich:column styleClass="left" style="width: 25%">
<h:outputText value="E-mail" />
</rich:column>
</rich:columnGroup>
</f:facet>
<rich:columnGroup>
<rich:column>
<h:commandButton image="/images/icon-select.png" alt="Select" actionListener="#{mainBean.selectUser(user)}" styleClass="icon-select">
<f:ajax execute="@form" render=":form:#{field}" />
<rich:componentControl target="popup-user" operation="hide" />
</h:commandButton>
</rich:column>
<rich:column>
<h:outputText value="#{user.id}" />
</rich:column>
<rich:column>
<h:outputText value="#{user.name}" />
</rich:column>
<rich:column>
<h:outputText value="#{user.email}" />
</rich:column>
</rich:columnGroup>
</rich:dataTable>
</h:panelGroup>
</h:panelGroup>
</rich:popupPanel>
</h:form>