0 Replies Latest reply on Oct 21, 2008 12:54 PM by corocotta

    Problems with CommandButton

    corocotta
      Hi,
      
      I'm learning Seam and I've crashed against the first problem.
      
      I'm uploading files and it works right, however when I show a list of the files that have been uploaded, I also show a Commandbutton to show all data asociated to the file.
      
      This is the view:
      
      ...
      <rich:panel>            
                  <f:facet name="header">#{messages['documentos.listado.titulo.tabla']}</f:facet>                  
                  <h:outputText value="#{messages['documentos.listado.nodocuments']}" rendered="#{listaDocumentos.rowCount==0}"/>            
                  <h:dataTable var="registro" value="#{listaDocumentos}" rendered="#{listaDocumentos.rowCount>0}">
                      <h:column>
                          <f:facet name="header"> 
                              <h:outputText value="#{messages['documentos.listado.titulo.title']}"/>
                          </f:facet>
                          <h:outputText value="#{registro.fileName}"/>
                      </h:column>                                     
                      <h:column>
                          <f:facet name="header"> 
                              <h:outputText value="#{messages['documentos.listado.titulo.fechaalta']}"/>
                          </f:facet>                    
                          <h:outputText value="#{registro.uploadDate}"    >
                              <s:convertDateTime pattern="dd/MM/yyyy"/>
                          </h:outputText>                    
                      </h:column> 
                      <h:column>
                          <f:facet name="header"> 
                              <h:outputText value="#{messages['documentos.listado.ver']}"/>
                          </f:facet>                       
                          <h:form>                        
                              <a:commandButton id="verDatos" value="Ver" action="#{publicDocumentAction.verDocumento(registro)}" reRender="seleccionDocumento"/>                        
                          </h:form>
                      </h:column> 
                  </h:dataTable>            
                  <a:outputPanel id="seleccionDocumento">
                      <rich:panel>
                          <f:facet name="header">Datos del documento</f:facet>
                          <h:outputText value="No se ha encontrado un documento" rendered="#{ficheroRetornado==null}"/>                    
                          <h:dataTable var="fichero" value="#{ficheroRetornado}" rendered="#{ficheroRetornado!=null}">
                              <h:column>
                                  <f:facet name="header"> 
                                      <h:outputText value="Nombre fichero"/>
                                  </f:facet>
                                  <h:outputText value="#{fichero.fileName}"/>
                              </h:column>                                                                 
                          </h:dataTable>                    
                      </rich:panel>                          
                  </a:outputPanel> 
              </rich:panel>
      ...
      
      And this is the action:
      
      ...
      @DataModelSelection       
          private Fichero ficheroRetornado;
      ...
      
      @Begin(join = true)
          public void verDocumento(Fichero ficheroView) {
              log.info("Llamada AJAX");
              if (ficheroView != null) {
                  log.info("Se obtiene el documento a mostrar: " + ficheroView.getFileName());
                  this.ficheroRetornado = ficheroView;
              } else {
                  log.error("No se ha indicado un documento a ver correctamente. Los parametros han llegado nulos");
              }
          }
      ...
      
      The problem is that when I press the commandbutton, there is no an answer. No mistakes, no incorrect data. Nothing at all.
      
      And when I upload a file I can read the trace "Llamada AJAX"...and I don't know why.
      
      Thank you very much.