1

我正在尝试使用dataScroller来显示数据库表的元素。它正确显示了所有元素,但是当我尝试使用某些操作时,它仅适用于最后一个元素,例如:

<p:commandButton value="vote"
                 action="#{avisBean.updateAvis(in,email)}">

<p:commandButton value="commenter" icon="ui-icon-check"
                 action="#{avisBean.addAvis(in,email)}">`

而对于其他人来说,只是空字符串进入数据库。我该如何纠正?

这是代码:

            <h:form id="commandLink">
            <p:dataScroller value="#{ideeBean.idees}" var="in" chunkSize="10"
                mode="inline" scrollHeight="500">
                <f:facet name="header">
   Les Idées 
    </f:facet>

                <h:panelGrid columns="1" style="width:100%"
                    columnClasses="logo,detail">
                    <!--             <p:graphicImage name="demo/images/car/#{car.brand}-big.gif" />  -->

                    <p:outputPanel>
                        <h:panelGrid columns="2" cellpadding="5">
                            <h:outputText value="#{msg['idee.titre']}" />

                            <h:outputText value="#{in.titre}" style="font-weight: bold" />

                            <h:outputText value="#{msg['idee.description']}" />

                            <h:outputText value="#{in.description}"
                                style="font-weight: bold" />

                            <h:outputText value="#{msg['idee.theme']}" />

                            <h:outputText value="#{in.theme}" style="font-weight: bold" />
                            <h:outputText value="#{msg['idee.type']}" />

                            <h:outputText value="#{in.type}" style="font-weight: bold" />
                            <!-- *******************Rating**************** -->
                        </h:panelGrid>
                    </p:outputPanel>
                    <h:panelGrid columns="4" cellpadding="5">
                    <p:commandButton value="details"
                        action="details?faces-redirect=true"
                        actionListener="#{ideeBean.attrListener}">
                        <f:attribute name="idee" value="#{in}" />
                    </p:commandButton>
                    <!--************************************** -->
<p:selectOneMenu id="console" value="#{avisBean.avis.score}"
                style="width:125px"  converter="javax.faces.Integer">
                <f:convertNumber integerOnly="true" />
                <f:selectItem itemLabel="Choisir" itemValue="" />
                <f:selectItem itemLabel="Horrible" itemValue="1" />
                <f:selectItem itemLabel="médiocre" itemValue="2" />
                <f:selectItem itemLabel="Bon" itemValue="3" />
                <f:selectItem itemLabel="Trés Bon" itemValue="4" />
                <f:selectItem itemLabel="Excellent" itemValue="5" />
            </p:selectOneMenu>
        <p:commandButton value="vote"
                        action="#{avisBean.updateAvis(in,email)}">
                    </p:commandButton>
                    </h:panelGrid>
                    <!-- ***************************comments******************** -->

                    <p:dataScroller id="growl"
                        value="#{ideeBean.getAllAvisList(in.id)}" var="a" chunkSize="2">
                        <f:facet name="header">
      commentaires
    </f:facet>

                        <f:facet name="loader">
                            <p:commandButton type="button" value="Plus"
                                icon="ui-icon-circle-triangle-s" />

                        </f:facet>

                        <h:panelGrid columns="1">
                            <!--             <p:graphicImage name="demo/images/car/#{car.brand}-big.gif" />  -->

                            <p:outputPanel>
                                <h:panelGrid columns="4" cellpadding="5">
                                    <h:outputText value="#{a.user_avis.nom}" />
                                    <p:inplace id="ajax" editor="true">
                                        <p:ajax event="save" listener="#{avisBean.updateAvis(a)}" />
                                        <h:inputText value="#{a.commentaire}"
                                            style="font-weight: bold" rendered="#{not empty a.commentaire}" />
                                    </p:inplace>

                                    <p:commandButton value="Supprimer"
                                        action="#{ideeBean.deleteAvisById(in.id,a.id)}"
                                        icon="ui-icon-arrowrefresh-1-w"
                                        rendered="#{utilisateurBean.getAllAvis(a,userid)}">
                                            <f:param name="userid" value="#{loginBean.id}"></f:param>
                                    </p:commandButton>
                                </h:panelGrid>

                            </p:outputPanel>

                        </h:panelGrid>
                    </p:dataScroller>
                    <!-- ***************************************** -->
                    <h:panelGrid columns="1">
                        <p:inputTextarea rows="2" cols="50" id="comment"
                            value="#{avisBean.avis.commentaire}"  />

                        <p:commandButton value="commenter" icon="ui-icon-check"
                            action="#{avisBean.addAvis(in,email)}">
                            <f:param name="email" value="#{loginBean.email}"></f:param>
                        </p:commandButton>
                    </h:panelGrid>
                    <h:panelGrid columns="1" style="width:100%">
                        <p:graphicImage value="resources/images/separateurr.png" />
                    </h:panelGrid>

                </h:panelGrid>
            </p:dataScroller>

        </h:form>
4

0 回答 0