在JSF2.0中根据运行时的某些条件设置下拉值

在JSF2.0中根据运行时的某些条件设置下拉值,jsf,primefaces,Jsf,Primefaces,我试图在primefaces JSF的下拉框中设置值。我有一个数据表,其中的数据来自数据库,在选择一行时,我需要检查一列的值,并根据这一点,我需要在下拉列表中设置值。下拉框中有两个值,它们也来自数据库。。我只需要根据datatable列的值设置一个值 我的数据表的代码 <p:dataTable var="patient" value="#{patientNotes.patientNote}" scrollable="true" scroll

我试图在primefaces JSF的下拉框中设置值。我有一个数据表,其中的数据来自数据库,在选择一行时,我需要检查一列的值,并根据这一点,我需要在下拉列表中设置值。下拉框中有两个值,它们也来自数据库。。我只需要根据datatable列的值设置一个值

我的数据表的代码

<p:dataTable var="patient"  value="#{patientNotes.patientNote}"
                        scrollable="true" scrollHeight="262" rowKey="#{patient.id}"
                        styleClass="mygrid" paginator="true" rows="10"
                        paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                        currentPageReportTemplate="(Displaying {startRecord} - {endRecord} of {totalRecords}, Page: {currentPage}/{totalPages})"
                        paginatorPosition="bottom" rowsPerPageTemplate="5,10,15"
                        selection="#{patientNotes.selectedNotes}" selectionMode="single">

                        <p:ajax event="rowSelect" listener="#{patientNotes.onRowSelect}"  />
                        <p:column style="text-align: center" width="180">
                            <f:facet name="header">
                                <h:outputText value="Type" />
                            </f:facet>
                            <h:graphicImage value="../../images/dialog-warning.png" rendered="#{patient.warning == 'Y'}"/>
                            <h:graphicImage  value ="../../images/alert.jpg" rendered="#{patient.alert == 'Y'}" />
                            <h:graphicImage value = "../../images/transaction_flat_16.gif"  rendered="#{patient.creditControl == 'Y'}" />
                        </p:column>
                        <p:column headerText="Note" width="180">

                            <h:outputText value="#{patient.note}" ></h:outputText>
                        </p:column>
                        <p:column headerText="Created By" width="180">

                            <h:outputText value="#{patient.createdBy}"></h:outputText>
                        </p:column>
                        <p:column headerText="Date" width="180">
                            <h:outputText value="#{patient.date}"></h:outputText>
                        </p:column>


                    </p:dataTable>
在选择行时,我需要检查一个变量警报,如果它是Y,我需要在下拉框alert else Admin中设置。。这两个值ALERT和Admin在数据库的下拉框中,我只需要设置它们

下拉列表代码

<h:panelGroup layout="block" class="inputContainer3" id="paneltype">
                    <span>Type: </span>
                    <h:selectOneMenu value="#{addNotes.typeSelection}" id="menutype">
                        <f:selectItem itemLabel=""
                            itemValue="1" />
                        <f:selectItems value="#{addNotes.selectedType}" />
                    </h:selectOneMenu>
                </h:panelGroup>
请帮助我,如果你有更多的代码请让我不要


提前感谢

将代码添加到您的支持bean中。是它现在不起作用还是怎么了?你的支持范围是什么?不清楚你的具体问题到底是什么。目前发布的Facelets代码乍一看很好。只有缺少的update属性,因此即使正确调用了listener方法,您也不会得到任何视觉反馈。也许这就是你的具体问题?