Java Primefaces中的update参数

时间:2014-11-04 20:58:16

标签: primefaces

我的问题有点棘手,我希望你得到我的解释,我会尽可能地清楚。

我有一个DataTable,它显示一个按钮,用于查看与所选项目相关的活动。这会打开一个带菜单的小面板,目前只有一个选项。这将打开另一个有两种形式的面板,我会做我需要的。

当我使用更新参数将我需要的信息添加到数据库中时,我的问题出现了。

这是我使用按钮的代码。

<p:commandLink action="#{reporteConsultorBean.verActividades(lead)}" update=":formMain:panelViewNotas" title="Ver actividades asociadas al Expediente">
   <center>
       <p:graphicImage value="/images/actividad32.png" />
   </center>
</p:commandLink>

这是单击按钮后弹出的对话框。

<p:dialog id="idDialogActitividades" header="Actividades del Expediente" 
            widgetVar="dialogActividades" resizable="true" 
            showEffect="slide" hideEffect="fade">               
                    <center>
                        <p:panel header="Actividades del Expediente" >                          
                            <p:panelGrid columns="1">
                                <p:commandLink title="Notas" onclick="dialogNotaView.show(); return           false;" style="margin:0 auto">
                                    <center>
                                      <p:graphicImage value="/images/nota.png"/>
                                    </center>                                           
                                </p:commandLink>                                
                            </p:panelGrid>
                            <br/>
                            <p:panelGrid columns="1" >
                                    <p:commandLink title="Cerrar" onclick="dialogActividades.hide(); return false;" style="margin:0 auto">
                                                <p:graphicImage value="/images/cerrarBoton.png"/>
                                    </p:commandLink>
                            </p:panelGrid>
                        </p:panel>
                        <br />
                </center>
</p:dialog>

这是将数据保存到de DB的形式。

<p:dialog header="Notas del Expediente" width="950"
            widgetVar="dialogNotaView" resizable="true"  minWidth="950"
            showEffect="slide" hideEffect="fade">                                                   
            <p:panelGrid columns="2" width="930">                       
                <p:panelGrid columns="1" width="75">
                    <p:commandLink title="Notas" onclick="return false;" style="margin:0 auto">
                    <center>
                      <p:graphicImage value="/images/nota.png"/>
                      </center>                                             
                        </p:commandLink>            
                           </p:panelGrid>                       
                              <p:panel id="panelViewNotas" header="Notas del Expediente" width="830">       
                              <center>  
                                <h:form id="formNotas">
                                <p:messages id="messagesNotas" showDetail="true" autoUpdate="true" />       
                                <p:panelGrid id="panelTabNotas" columns="2" width="800">
                                <f:facet name="header">
                                    Nota
                                </f:facet>
                                <p:graphicImage value="/images/nota.png" />
                                <h:outputText value="Nota" />
                                <h:outputText value="" />
                                <h:outputText value="" />

                                <h:outputText value="Nombre/Tema *" />
                                <p:inputText value="#{reporteConsultorBean.notaView.nombre}" required="false" requiredMessage="Es necesario que ingrese el asunto" 
                                                size="50" maxlength="49" />                                         
                                <h:outputText value="Descripción *" />
                                <p:inputTextarea value="#{reporteConsultorBean.notaView.descripcion}" rows="4" cols="65" maxlength="270"
                                                required="false" requiredMessage="Es necesario que ingrese la descripción de la nota." />       
                                </p:panelGrid>
                                <br/>
                                <p:panelGrid columns="2" >
                                <p:commandLink actionListener="#{reporteConsultorBean.saveNota}" 
                                                        update=":formMain:growl,:formMain:formNotasResult:panelResultadoNotas,:formMain:formNotas:panelTabNotas,:formMain:formNotas:messagesNotas" title="Guardar Nota" style="margin:0 auto"   >
                                <center>
                                <p:graphicImage value="/images/guardarBoton.png"/>
                                </center>                                           
                                </p:commandLink>
                                <p:commandLink title="Cerrar" onclick="dialogNotaView.hide(); return false;" style="margin:0 auto">
                                <center>
                                <p:graphicImage value="/images/cerrarBoton.png"/>
                                </center>                                           
                                </p:commandLink>
                                </p:panelGrid>
                                </h:form>   
                                <br/>
                                <p:separator style="width:700px;height:10px" /> 
                                <br/>
                                <h:form id="formNotasResult">
                                <p:panel id="panelResultadoNotas" header="Notas del Expediente" width="830">
                                  <p:dataTable id="tablaNotasResumen" var="notaResumen" 
                                                value="#{reporteConsultorBean.notasExp}" rowKey="#{notaResumen.idNota}"
                                                paginator="true" rows="4" emptyMessage="No hay registros"
                                                selectionMode="single"  selection="#{reporteConsultorBean.notaSelected}">                                           
                                    <p:column headerText="Nombre/Asunto">  
                                                  #{notaResumen.nombre}
                                    </p:column>
                                    <p:column headerText="Descripción">                                               #{notaResumen.descripcion}
                                    </p:column>
                                    <p:column headerText="Creador">  
                                                  #{notaResumen.actividad.creador}
                                    </p:column>
                                    <p:column headerText="Fecha Creación">  
                                    <h:outputText value="#{notaResumen.actividad.fechaCreacion}">  
                                    <f:convertDateTime type="date" pattern="dd-MM-yyyy"/>
                                    </h:outputText>
                                    </p:column>                                                                     
                                    <p:column>
                                    <p:commandLink title="Editar Nota"  
                                                                update=":formMain:formNotas:panelTabNotas"
                                                                 action="#{reporteConsultorBean.editarNota(notaResumen)}">
                                            <p:graphicImage value="/images/editarBoton.png" />                                                        
                                    </p:commandLink>
                                   </p:column>
                            </p:dataTable>
                      </p:panel>
            </h:form>   
        </center>
        <br/>
</p:panel>

当我使用&#34; panelViewNotas&#34;在上面的按钮。当我使用它时,一切都会显示出来,但是当我点击&#34; Save&#34;在最后一个表单上的按钮,没有任何反应(甚至在Log或Tomcat中都没有nullPointerException)。 当我使用时:

update=":formMain:formNotasResult:panelResultadoNotas,:formMain:formNotas:panelTabNotas" 

数据存储在数据库中没有任何问题,但整个事物的视图搞砸了#34; DialogNotaView&#34;它将一种形式显示在另一种形式的顶部。

我希望你明白这个问题,你可以帮助我。 我该如何解决这个问题?

0 个答案:

没有答案