JBoss / RichFaces:如果DataTable中的第一个selectOneMenu为空,则不调用Action

时间:2014-08-14 17:32:43

标签: jboss richfaces

我在JBoss上遇到richfaces页面有问题。该页面包含(除其他外)要关闭的项目列表。在关闭项目之前,必须选择一个原因。并非所有项目都需要填写。留空的那些没有关闭并保留在表格中。

现在出现问题:如果第一行留空(无论填写哪个其他行),页面都会重新加载,但是从不调用在命令按钮(adminInformationBean.startClosingProjects())上指定为操作的函数。如果至少为第一行选择了一个原因,那么一切正常。

这是xhtml文件:

<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.org/schema/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich"
    template="/layout/template.xhtml"
    xmlns:a4j="http://richfaces.org/a4j">

    <ui:define name="body">

        <div id="cku1405090004">
            <h:form id="uma1407080001">
                <div>
                    <rich:panel styleClass="PanelHeader">
                        <f:facet name="header">
                            #{messages.adminInfo_table_header}
                        </f:facet>
                        <rich:tabPanel id="myTabPanelAdminInfo" styleClass="PanelHeader">

                        [...]

<!-- closed Projects  -->
                            <rich:tab id="closedProjects">
                                <f:facet name="header">#{messages.adminInfo_table_type_close}
                                    <h:outputText value="#{adminInformationBean.closedProjectsSize}"/>
                                </f:facet>

                                <div class="actionButtons">
                                    <div class="ViewButtonLeft" />
                                    <h:commandButton id="cku1405090011" styleClass="ViewSubmitButtonBody" value="#{messages['adminInfo_table_button_check']}" action="#{adminInformationBean.startClosingProjects()}" onclick="doPostBack();"/>
                                    <div class="ViewButtonRight" />
                                </div>

                                <rich:dataTable id="closedProjectsTableId" styleClass="rich-datatable" value="#{adminInformationBean.infoListClosedProjects}" var="adminInfo" iterationStatusVar="iterator" rows="#{adminInformationBean.selectedItem}" rowKeyVar="row" rowClasses="ViewOddLine, ViewEvenLine">
                                    <f:facet name="noData">#{messages.team_table_filter_message}</f:facet>
                                    <f:facet name="header">
                                        <rich:columnGroup>
                                            <rich:column>
                                                <span>
                                                    <h:outputText value="#{messages.adminInfo_table_header_projectName} " />
                                                </span>
                                            </rich:column>
                                            <rich:column>
                                                <span>
                                                    <h:outputText value="#{messages.adminInfo_table_header_reason}" />
                                                </span>
                                            </rich:column>
                                        </rich:columnGroup>
                                    </f:facet>


                                    <rich:column filterValue="#{filterBean.projectNameFilter}" filterExpression="#{fn:containsIgnoreCase(adminInfo.projectName, filterBean.projectNameFilter)}">
                                        <f:facet name="header">
                                            <h:panelGroup>
                                                <h:inputText id="projectNameClose" value="#{filterBean.projectNameFilter}">
                                                    <a4j:ajax render="closedProjectsTableId@body, tgrid2Id4@body" execute="@this" event="keyup" />
                                                </h:inputText>
                                            </h:panelGroup>
                                        </f:facet>
                                        <span>
                                            <h:outputText value="#{adminInfo.projectName}" rendered="#{adminInfo.projectName != null}"/>
                                        </span>
                                    </rich:column>
                                    <rich:column>
                                        <div align="center">
                                            <h:selectOneMenu class="selectReason" value="#{adminInfo.reason}">
                                                <s:selectItems value="#{adminInformationBean.possibleReasons}" var="reason" label="#{reason.name}" itemValue="#{reason.id}" noSelectionLabel=""  />
                                            </h:selectOneMenu>
                                        </div>
                                    </rich:column>

                                </rich:dataTable>
                                <h:panelGrid id="tgrid2Id4" columns="3">
                                    #{messages.team_table_rows_selectonemenu}
                                    <h:selectOneMenu value="#{adminInformationBean.selectedItem}" onchange="submit()" valueChangeListener="#{adminInformationBean.pageSizeValueChanged}"> 
                                        <f:selectItems value="#{adminInformationBean.selectItemsMap}"/> 
                                    </h:selectOneMenu>
                                    <rich:dataScroller for="closedProjectsTableId" page="#{adminInformationBean.page}" maxPages="" fastControls="hide">
                                        <f:facet name="first">
                                            <h:outputText value="&lt;&lt;"/>
                                        </f:facet>
                                        <f:facet name="previous">
                                            <h:outputText value="&lt;"/>
                                        </f:facet>
                                        <f:facet name="next">
                                            <h:outputText value="&gt;"/>
                                        </f:facet>
                                        <f:facet name="last">
                                            <h:outputText value="&gt;&gt;"/>
                                        </f:facet>
                                    </rich:dataScroller>
                                </h:panelGrid>

                                <div class="actionButtons" style="padding-bottom: 20px">
                                    <div>
                                        <div class="ViewButtonLeft" />
                                        <h:commandButton id="cku1405090012" styleClass="ViewSubmitButtonBody" value="#{messages['adminInfo_table_button_check']}" action="#{adminInformationBean.startClosingProjects()}" onclick="doPostBack();"/>
                                        <div class="ViewButtonRight" />
                                    </div>
                                </div>
                            </rich:tab>

                            [...]

                        </rich:tabPanel>

                    </rich:panel>
                </div>
            </h:form>
        </div>


    </ui:define>
</ui:composition>

0 个答案:

没有答案