2 Replies Latest reply on Jan 31, 2011 8:32 PM by Tim Evers

    Problem with Richfaces

    Carlos Medina Newbie

      I've been working a bit with Seam and RichFaces and this problem seems to be out of my bubble of knowledge.
      The problem is that whenever I hit the generate report button and have the semester option picked, the data returned on the semestreSeleccionado variable is null.
      A friend suggested this be due to Ajax, yet I have been unable to find anything, here I leave the xhtml and bean that is called upon




      <?xml version="1.0" encoding="ISO-8859-1"?>
      
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:ui="http://java.sun.com/jsf/facelets"
              xmlns:a4j="http://richfaces.org/a4j"
              xmlns:rich="http://richfaces.org/rich"
              xmlns:ajax="https://ajax4jsf.dev.java.net/ajax"
              xmlns:s="http://jboss.com/products/seam/taglib"
              template="/layout/sfpTemplate.xhtml">
      
              <ui:define name="body">
                      <h:form>
                              <rich:panel id="panelBusqueda">
                                      <f:facet name="header">
                                              <h:outputText value="Generación de reportes de verificaciones" />
                                      </f:facet>
      
                                      <s:decorate template="../layout/edit.xhtml">
                                              <ui:define name="label">Periodo: </ui:define>
                                              <h:selectOneRadio value="#{gestorReportesAseguramiento.tipo}">
                                                      <f:selectItem itemValue="1" itemLabel="Mensual" />
                                                      <f:selectItem itemValue="2" itemLabel="Semestral" />
                                                      <f:selectItem itemValue="3" itemLabel="Anual" />
                                                      <a4j:support event="onclick" reRender="richMensual,richSemestral,richAnual"/>
                                              </h:selectOneRadio>
                                      </s:decorate>
      
                                      <br />
                                      <rich:panel id="richMensual" style="border:0;">
                                              <rich:panel id="rMensual" style="border:0;"
                                                      rendered="#{gestorReportesAseguramiento.tipo == 1}">
                                                      <s:decorate template="../layout/edit.xhtml">
                                                              <ui:define name="label">
                                                                      <span class="asteriscos">*</span>Mes</ui:define>
                                                              <h:selectOneMenu id="selctorMes"
                                                                      value="#{gestorReportesAseguramiento.mesSeleccionado}">
                                                                      <s:selectItems var="mesActual" value="#{tiendaEnums.meses2}"
                                                                              label="#{mesActual}" noSelectionLabel="Seleccionar..." />
                                                                      <a4j:support event="onchange" ajaxSingle="true" />
                                                              </h:selectOneMenu>
                                                      </s:decorate>
                                                      <s:decorate template="../layout/edit.xhtml">
                                                              <ui:define name="label">
                                                                      <span class="asteriscos">*</span>Año</ui:define>
                                                              <h:selectOneMenu id="selctorAnosUno"
                                                                      value="#{gestorReportesAseguramiento.anoSeleccionado}">
                                                                      <s:selectItems var="anoActual"
                                                                              value="#{gestorReportesAseguramiento.listaAnos}" label="#{anoActual}"
                                                                              noSelectionLabel="Seleccionar..." />
                                                                      <a4j:support event="onchange" ajaxSingle="true" />
                                                              </h:selectOneMenu>
                                                      </s:decorate>
                                              </rich:panel>
                                      </rich:panel>
      
                                      <rich:panel id="richSemestral" style="border:0;">
                                              <rich:panel id="rSemestral" style="border:0;"
                                                      rendered="#{gestorReportesAseguramiento.tipo == 2}">
                                                      <s:decorate template="../layout/edit.xhtml">
                                                              <ui:define name="label">
                                                                      <span class="asteriscos">*</span>
                                                                      Semestre</ui:define>
                                                              <h:selectOneMenu id="selctorSem"
                                                                      value="#{gestorReportesAseguramiento.semestreSeleccionado}">
                                                                      <s:selectItems var="semActual" value="#{tiendaEnums.semestres}"
                                                                              label="#{semActual}" noSelectionLabel="Seleccionar..." />
                                                                      <a4j:support event="onchange" ajaxSingle="true" />
                                                              </h:selectOneMenu>
                                                      </s:decorate>
                                                      <s:decorate template="../layout/edit.xhtml">
                                                              <ui:define name="label"><span class="asteriscos">*</span>Año</ui:define>
                                                              <h:selectOneMenu id="selctorAnosDos"
                                                                      value="#{gestorReportesAseguramiento.anoSeleccionado}">
                                                                      <s:selectItems var="anoActual"
                                                                              value="#{gestorReportesAseguramiento.listaAnos}" label="#{anoActual}"
                                                                              noSelectionLabel="Seleccionar..." />
                                                                      <a4j:support event="onchange" ajaxSingle="true" />
                                                              </h:selectOneMenu>
                                                      </s:decorate>
                                              </rich:panel>
                                      </rich:panel>
      
                                      <rich:panel id="richAnual" style="border:0;">
                                              <rich:panel id="rAnual" style="border:0;"
                                                      rendered="#{gestorReportesAseguramiento.tipo == 3}">
                                                      <s:decorate template="../layout/edit.xhtml">
                                                              <ui:define name="label"><span class="asteriscos">*</span>Año</ui:define>
                                                              <h:selectOneMenu id="selctorAnos"
                                                                      value="#{gestorReportesAseguramiento.anoSeleccionado}">
                                                                      <s:selectItems var="anoActual"
                                                                              value="#{gestorReportesAseguramiento.listaAnos}" label="#{anoActual}"
                                                                              noSelectionLabel="Seleccionar..." />
                                                                      <a4j:support event="onchange" ajaxSingle="true" />
                                                              </h:selectOneMenu>
                                                      </s:decorate>
                                              </rich:panel>
                                      </rich:panel>
      
                                      <s:decorate id="folio" template="../layout/edit.xhtml">
                                              <ui:define name="label">Folio</ui:define>
                                              <h:inputText value="#{gestorReportesAseguramiento.folio}" />
                                      </s:decorate>
                                      
                                      <s:decorate template="../layout/edit.xhtml">
                                              <ui:define name="label">Institución: </ui:define>
                                              <h:selectOneMenu id="lDependencias"
                                                      value="#{dependenciaHome.instance}" style=" width : 400px;">
                                                      <s:selectItems value="#{dependencias}" var="lDependencia"
                                                              label="#{lDependencia.nombre}" noSelectionLabel="Seleccionar..." />
                                                      <s:convertEntity />
                                              </h:selectOneMenu>
                                      </s:decorate>
                                      <h:outputText value="#{messages['label.campos.obligatorios']}"
                                              styleClass="asteriscos" />
                              </rich:panel>
                              <div class="barraBotones">
                                      <h:commandButton styleClass="inputSubmit"
                                              action="#{gestorReportesAseguramiento.generarReporteVerificacionesSR(1)}"
                                              value="Generar Reporte">
                                              <a4j:support event="onclick"
                                                      onsubmit="jQuery('#loadingBusqueda').show();"
                                                      oncomplete="jQuery('#loadingBusqueda').hide();" />
                                      </h:commandButton>
                              </div>
                              <span id="loadingBusqueda" style="display: none"><h:graphicImage
                                      value="#{messages['icono.loading']}" /></span>
                              <rich:panel rendered="#{gestorReportesAseguramiento.ceroResultados}">
                                      <f:facet name="header">No se han encontrado registros</f:facet>
                                      <br/>
                                      <h:outputText value="#{messages['label.sinResultados']}" />
                                      <br/>
                              </rich:panel>
                      </h:form>
              </ui:define>
      </ui:composition>





      package mx.gob.funcionpublica.siac.logica.aseguramientoCalidad;
      
      import java.util.ArrayList;
      import java.util.Date;
      import java.util.List;
      import java.util.Locale;
      import java.util.ResourceBundle;
      
      import mx.gob.funcionpublica.siac.logica.Autorizador;
      import mx.gob.funcionpublica.siac.logica.GestorDiasFestivos;
      import mx.gob.funcionpublica.siac.logica.Periodos;
      import mx.gob.funcionpublica.siac.logica.SiacEntityManager;
      import mx.gob.funcionpublica.siac.logica.catalogos.DependenciaHome;
      import mx.gob.funcionpublica.siac.logica.catalogos.TramiteHome;
      import mx.gob.funcionpublica.siac.logica.meta.Registrable;
      import mx.gob.funcionpublica.siac.logica.meta.RegistrarEvento;
      import mx.gob.funcionpublica.siac.modelo.Usuario;
      import mx.gob.funcionpublica.siac.modelo.aseguramiento.ge.GrupoEnfoque;
      import mx.gob.funcionpublica.siac.modelo.aseguramiento.ve.Verificacion;
      import mx.gob.funcionpublica.siac.modelo.aseguramiento.vesr.AreaVerificada;
      import mx.gob.funcionpublica.siac.modelo.aseguramiento.vesr.AtributoVerificado;
      import mx.gob.funcionpublica.siac.modelo.aseguramiento.vesr.VerificacionSupervisoria;
      import mx.gob.funcionpublica.siac.modelo.catalogos.Dependencia;
      import mx.gob.funcionpublica.siac.modelo.catalogos.EstadoVerificacionSupervisoria;
      import mx.gob.funcionpublica.siac.modelo.catalogos.Tramite;
      
      import org.jboss.seam.ScopeType;
      import org.jboss.seam.annotations.In;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.Scope;
      import org.jboss.seam.faces.FacesMessages;
      import org.jboss.seam.framework.EntityQuery;
      
      @Name(value = "gestorReportesAseguramiento")
      @Scope(ScopeType.CONVERSATION)
      @Registrable
      public class GestorReportesAseguramiento {
      
              private String redirecciona = "";
              private Integer anoSeleccionado = 0;
              private String mesSeleccionado = "";
              private String semestreSeleccionado = "";
      
              private String folio;
              private Date fechaInicio;
              private Date fechaFin;
              private Date fechaActual = new Date();
              private int tipo = 1;
      
              private Date fechaInicioAno;
              private Date fechaFinAno;
              private Date fechaInicioSemestre;
              private Date fechaFinSemestre;
              private Date fechaInicioMes;
              private Date fechaFinMes;
      
              private Tramite tramite;
              @In(create=true)
              private Autorizador autorizador;
      
              @In(value = "tramiteHome", create = true, required = false)
              private TramiteHome tramiteHome;
      
              private Dependencia dependencia;
      
              private Dependencia dependenciaSR;
      
              @In(create = true)
              private DependenciaHome dependenciaHome;
      
              private VerificacionSupervisoria verificacionSR;
              
              private EstadoVerificacionSupervisoria etapa;
      
              @In(value = "usuario", create = true, required = false)
              private Usuario usuario;
      
              @In(value = "periodos", create = true, required = false)
              private Periodos periodo;
      
              private List<Integer> listaAnos = new ArrayList<Integer>();
      
              @In(value = "gestorDiasFestivos", create = true, required = false)
              GestorDiasFestivos gestorDiasFestivos;
      
              @In(value = "siacEntityManager", create = true)
              private SiacEntityManager siacEntityManager;
      
              @In(value = "gruposEnfoquePorTramite", create = true, required = false)
              private EntityQuery<GrupoEnfoque> gruposEnfoqueTramite;
              private List<GrupoEnfoque> listaGruposEnfoqueTramite = new ArrayList<GrupoEnfoque>();
      
              @In(value = "verificacionesPorTramite", create = true, required = false)
              private EntityQuery<Verificacion> verificacionesTramite;
              private List<Verificacion> listaVerificacionesTramite = new ArrayList<Verificacion>();
      
              @In(value = "verificacionesSR", create = true, required = false)
              private EntityQuery<VerificacionSupervisoria> verificacionesSR;
              private List<VerificacionSupervisoria> listaVerificacionesSR = new ArrayList<VerificacionSupervisoria>();
              
              private ResourceBundle bundleAseguramiento = ResourceBundle.getBundle(
                              "aseguramiento_participacion", Locale.getDefault());
              @In
              private FacesMessages facesMessages;
              
              private boolean ceroResultados;
              
      
              public String getFolio() {
                      return folio;
              }
      
              public void setFolio(String folio) {
                      this.folio = folio;
              }
      
              public Date getFechaInicio() {
                      return fechaInicio;
              }
      
              public void setFechaInicio(Date fechaInicio) {
                      this.fechaInicio = fechaInicio;
              }
      
              public Date getFechaFin() {
                      return fechaFin;
              }
      
              public void setFechaFin(Date fechaFin) {
                      this.fechaFin = fechaFin;
              }
      
              public Date getFechaActual() {
                      return fechaActual;
              }
      
              public void setFechaActual(Date fechaActual) {
                      this.fechaActual = fechaActual;
              }
      
              public int getTipo() {
                      return tipo;
              }
      
              public void setTipo(int tipo) {
                      this.tipo = tipo;
              }
      
              public Tramite getTramite() {
                      return tramite;
              }
      
              public void setTramite(Tramite tramite) {
                      this.tramite = tramite;
              }
      
              public Dependencia getDependencia() {
                      return dependencia;
              }
      
              public void setDependencia(Dependencia dependencia) {
                      this.dependencia = dependencia;
              }
      
              public Dependencia getDependenciaSR() {
                      return dependenciaSR;
              }
      
              public void setDependenciaSR(Dependencia dependenciaSR) {
                      this.dependenciaSR = dependenciaSR;
              }
      
              public Integer getAnoSeleccionado() {
                      return anoSeleccionado;
              }
      
              public void setAnoSeleccionado(Integer anoSeleccionado) {
                      this.anoSeleccionado = anoSeleccionado;
              }
      
              public String getMesSeleccionado() {
                      return mesSeleccionado;
              }
      
              public void setMesSeleccionado(String mesSeleccionado) {
                      this.mesSeleccionado = mesSeleccionado;
              }
      
              public String getSemestreSeleccionado() {
                      return semestreSeleccionado;
              }
      
              public void setSemestreSeleccionado(String semestreSeleccionado) {
                      this.semestreSeleccionado = semestreSeleccionado;
              }
      
              public Date getFechaInicioAno() {
                      return fechaInicioAno;
              }
      
              public void setFechaInicioAno(Date fechaInicioAno) {
                      this.fechaInicioAno = fechaInicioAno;
              }
      
              public Date getFechaFinAno() {
                      return fechaFinAno;
              }
      
              public void setFechaFinAno(Date fechaFinAno) {
                      this.fechaFinAno = fechaFinAno;
              }
      
              public Date getFechaInicioSemestre() {
                      return fechaInicioSemestre;
              }
      
              public void setFechaInicioSemestre(Date fechaInicioSemestre) {
                      this.fechaInicioSemestre = fechaInicioSemestre;
              }
      
              public Date getFechaFinSemestre() {
                      return fechaFinSemestre;
              }
      
              public void setFechaFinSemestre(Date fechaFinSemestre) {
                      this.fechaFinSemestre = fechaFinSemestre;
              }
      
              public Date getFechaInicioMes() {
                      return fechaInicioMes;
              }
      
              public void setFechaInicioMes(Date fechaInicioMes) {
                      this.fechaInicioMes = fechaInicioMes;
              }
      
              public Date getFechaFinMes() {
                      return fechaFinMes;
              }
      
              public void setFechaFinMes(Date fechaFinMes) {
                      this.fechaFinMes = fechaFinMes;
              }
      
              public VerificacionSupervisoria getVerificacionSR() {
                      return verificacionSR;
              }
      
              public void setVerificacionSR(VerificacionSupervisoria verificacionSR) {
                      this.verificacionSR = verificacionSR;
              }
      
              public EstadoVerificacionSupervisoria getEtapa() {
                      return etapa;
              }
      
              public void setEtapa(EstadoVerificacionSupervisoria etapa) {
                      this.etapa = etapa;
              }
      
              @SuppressWarnings("deprecation")
              public List<Integer> getListaAnos() {
                      listaAnos.clear();
                      if (listaAnos != null || listaAnos.isEmpty()) {
                              int year = new Date().getYear() + 1900;
                              for (int i = 0; i < 10; i++)
                                      listaAnos.add(year - i);
                      }
                      return listaAnos;
              }
      
              public void setListaAnos(List<Integer> listaAnos) {
                      this.listaAnos = listaAnos;
              }
      
              public List<GrupoEnfoque> getListaGruposEnfoqueTramite() {
                      if (listaGruposEnfoqueTramite != null
                                      || listaGruposEnfoqueTramite.isEmpty()) {
                              if (tramiteHome.getInstance().getTramiteId() > 0) {
                                      tramite = tramiteHome.getInstance();
                              } else
                                      tramite = null;
                              listaGruposEnfoqueTramite = gruposEnfoqueTramite.getResultList();
                      }
                      return listaGruposEnfoqueTramite;
              }
      
              public void setListaGruposEnfoqueTramite(
                              List<GrupoEnfoque> listaGruposEnfoqueTramite) {
                      this.listaGruposEnfoqueTramite = listaGruposEnfoqueTramite;
              }
      
              public List<Verificacion> getListaVerificacionesTramite() {
                      if (listaVerificacionesTramite != null
                                      || listaVerificacionesTramite.isEmpty()) {
                              if (tramiteHome.getInstance().getTramiteId() > 0) {
                                      tramite = tramiteHome.getInstance();
                              } else
                                      tramite = null;
                              listaVerificacionesTramite = verificacionesTramite.getResultList();
                              
                      }
                      return listaVerificacionesTramite;
              }
      
              public void setListaVerificacionesTramite(
                              List<Verificacion> listaVerificacionesTramite) {
                      this.listaVerificacionesTramite = listaVerificacionesTramite;
              }
      
              public List<VerificacionSupervisoria> getListaVerificacionesSR() {
                      if (listaVerificacionesSR != null || listaVerificacionesSR.isEmpty()) {
                              if (dependenciaHome.getInstance().getDependenciaId() > 0) {
                                      dependenciaSR = dependenciaHome.getInstance();
                              } else
                                      dependenciaSR = null;
                              listaVerificacionesSR = verificacionesSR.getResultList();
                      }
                      return listaVerificacionesSR;
              }
      
              public void setListaVerificacionesSR(
                              List<VerificacionSupervisoria> listaVerificacionesSR) {
                      this.listaVerificacionesSR = listaVerificacionesSR;
              }
              
              public void resultados(){
                      
                      
              }       
      
              @RegistrarEvento
              public String generarReporteGrupoEnfoque() {
                      if (getListaGruposEnfoqueTramite().size() > 0) {
                              if (this.tipo == 1){
                                      redirecciona =  "/asegCalidadReportes/reporteGrupoEnfoqueTramite.xhtml";
                              } else if (this.tipo == 2){
                                      redirecciona = "/asegCalidadReportes/reporteCompromisosGrupoEnfoque.xhtml";
                              } else {
                                      redirecciona = null;
                              }
                      } else {
                              redirecciona = null;
                      }
                      return redirecciona;
              }
      
              @RegistrarEvento
              public String generarReporteVerificacion() {
                      if (getListaVerificacionesTramite().size() > 0) {
                              if (this.tipo == 1){
                                      redirecciona = "/asegCalidadReportes/reporteVerificacionTramite.xhtml";
                              }else if (this.tipo == 2){
                                      redirecciona = "/asegCalidadReportes/reporteAreasVerificacion.xhtml";
                              } else if (this.tipo == 3) {
                                      redirecciona = "/asegCalidadReportes/reporteCompromisosVerificacion.xhtml";
                              } else {
                                      redirecciona = null;
                              }
                      } else {
                              redirecciona = null;
                      }
                      return redirecciona;
              }
              
      
      
      
              @RegistrarEvento
              public String generarReporteVerificacionesSR(int tipo) {
                      System.out.println("tipo local:"+tipo);
                      System.out.println("tipo global:"+this.tipo);
                      System.out.println("año:"+this.anoSeleccionado);
                      System.out.println("semestre:"+this.semestreSeleccionado);
                      System.out.println("mes:"+this.mesSeleccionado);
                      if(validar()){
                              obtenerPeriodos(this.tipo);
                      }else{
                              return null;
                      }
                      
                      if (getListaVerificacionesSR().size() > 0) {
                              if (tipo == 1) {
                                              return "/asegCalidadReportes/reporteVerificacionSRPorOrigen.xhtml";
                              } else if (tipo == 2) {
                                      return "/asegCalidadReportes/reporteVerificacionSRPorConclusion.xhtml";
                              } else if (tipo == 3) {
                                      return "/asegCalidadReportes/reporteVerificacionSRPorAutoridad.xhtml";
                              } else if (tipo == 4) {
                                      return "/asegCalidadReportes/reporteVerificacionSRPorVerificacion.xhtml";
                              } else if (tipo == 5) {
                                      return "/asegCalidadReportes/reporteVerificacionSRPorReporte.xhtml";
                              } else
                                      return null;
                      } else{
                              setCeroResultados(true);
                              return null;
                      }       
              }
      
              public int vencimientoQuinceDias(Date fechaInicio, long verificacionId,
                              int tipo) {
                      int nDias = 0;
                      int res = 0;
                      Date fechaActual = new Date();
                      if (fechaInicio != null) {
                              res = gestorDiasFestivos.calcularDiasHabiles(fechaInicio,
                                              fechaActual);
                              verificacionSR = siacEntityManager.obtenerVerificacionSupervisoriaPorId(verificacionId);
                              for (AreaVerificada _area : verificacionSR.getAreasVerificadas()) {
                                      for (AtributoVerificado _atributo : _area
                                                      .getAtributosVerificados()) {
                                              if (_atributo.getProblematica() != null) {
                                                      if (tipo == 1) {
                                                              if ((res <= 15)
                                                                              && (_atributo.getProblematica()
                                                                                              .getFechaProgramadaSolucion() == null)) {
                                                                      nDias++;
                                                              }
                                                      }
                                                      if (tipo == 2) {
                                                              if ((res > 15)
                                                                              && (res <= 18)
                                                                              && (_atributo.getProblematica()
                                                                                              .getFechaProgramadaSolucion() == null)) {
                                                                      nDias++;
                                                              }
                                                      }
                                                      if (tipo == 3) {
                                                              if ((res > 18)
                                                                              && (_atributo.getProblematica()
                                                                                              .getFechaProgramadaSolucion() == null)) {
                                                                      nDias++;
                                                              }
                                                      }
                                              }
                                      }
      
                              }
                      }
                      return nDias;
              }
      
              public void obtenerPeriodos(int intEtapa) {
                      if(intEtapa == 2)
                              this.etapa = EstadoVerificacionSupervisoria.CONCLUSION;
                      else
                              this.etapa = null;
                      
                      if (this.tipo == 1) {
                              fechaInicioMes = periodo
                                              .inicioMes(anoSeleccionado, mesSeleccionado);
                              fechaFinMes = periodo.finMes(anoSeleccionado, mesSeleccionado);
                      } else if (this.tipo == 2) {
                              fechaInicioSemestre = periodo.inicioSemestre(anoSeleccionado,
                                              semestreSeleccionado);
                              fechaFinSemestre = periodo.finSemestre(anoSeleccionado,
                                              semestreSeleccionado);
                      } else if (this.tipo == 3) {
                              fechaInicioAno = periodo.inicioAno(anoSeleccionado);
                              fechaFinAno = periodo.finAno(anoSeleccionado);
                      }
              }
              
              public boolean validar(){
                      boolean valido = true;
                      String anoSel = "";
                      if(getTipo() == 1){
                              if(mesSeleccionado == null){
                                      facesMessages.addToControl("selctorMes", bundleAseguramiento.getString("validate.reporteOrigen"));
                                      anoSel = "selctorAnosUno";
                                      valido = false;
                              }
                      }else if(getTipo() == 2){
                              if(semestreSeleccionado == null){
                                      facesMessages.addToControl("selctorSem", bundleAseguramiento.getString("validate.reporteOrigen"));
                                      anoSel = "selctorAnosDos";
                                      valido = false;
                              }
                      }else if(getTipo() == 3){
                              anoSel = "selctorAnos";
                      }
                      if(anoSeleccionado == null){
                                      facesMessages.addToControl(anoSel, bundleAseguramiento.getString("validate.reporteOrigen"));
                              valido = false;
                      }
                      return valido;
              }
      
              @RegistrarEvento
              public void inicializar() {
                      if (autorizador.tienePermiso("VE", "CONSULTA", "GENERAL") ||   
                                      autorizador.tienePermiso("VE", "MODIFICACION", "GENERAL") ||
                                      autorizador.tienePermiso("VE", "CREACION", "GENERAL") || 
                                      autorizador.tienePermiso("FG", "CONSULTA", "GENERAL") ||   
                                      autorizador.tienePermiso("FG", "MODIFICACION", "GENERAL") ||
                                      autorizador.tienePermiso("FG", "CREACION", "GENERAL")){
                              this.dependencia = null;
                              this.usuario = null;
                      }else{
                              this.dependencia = usuario.getDependencia();
                      }
              }
      
              public String getRedirecciona() {
                      return redirecciona;
              }
      
              public void setRedirecciona(String redirecciona) {
                      this.redirecciona = redirecciona;
              }
      
              public boolean isCeroResultados() {
                      return ceroResultados;
              }
      
              public void setCeroResultados(boolean ceroResultados) {
                      this.ceroResultados = ceroResultados;
              }
      
              public Usuario getUsuario() {
                      if (autorizador.tienePermiso("FG", "CONSULTA", "GENERAL") ||   
                                      autorizador.tienePermiso("FG", "MODIFICACION", "GENERAL") ||
                                      autorizador.tienePermiso("FG", "CREACION", "GENERAL") ||
                                      autorizador.tienePermiso("VE", "CONSULTA", "GENERAL") ||   
                                      autorizador.tienePermiso("VE", "MODIFICACION", "GENERAL") ||
                                      autorizador.tienePermiso("VE", "CREACION", "GENERAL") ){
                              return  null;
                      }
                      return usuario;
              }
      
              public void setUsuario(Usuario usuario) {
                      this.usuario = usuario;
              }
      
      }
      



      if anyone can spot a solution to this, or needs anything I'd appreciate the help.



        • 1. Re: Problem with Richfaces
          Tamas Malatinszki Newbie

          Hi Carlos,


          Try to use a4j:commandButton instead of h:commandButton:


          <a4j:commandButton styleClass="inputSubmit"
                             action="#{gestorReportesAseguramiento.generarReporteVerificacionesSR(1)}"
                             onclick="jQuery('#loadingBusqueda').show();"
                             oncomplete="jQuery('#loadingBusqueda').hide();"/>
          </a4j:commandButton>



          and a4j:form instead h:form.


          Regards,


          Tamas


          • 2. Re: Problem with Richfaces
            Tim Evers Master

            Tamas Malatinszki wrote on Jan 31, 2011 09:36:


            Hi Carlos,

            Try to use a4j:commandButton instead of h:commandButton:

            <a4j:commandButton styleClass="inputSubmit"
                               action="#{gestorReportesAseguramiento.generarReporteVerificacionesSR(1)}"
                               onclick="jQuery('#loadingBusqueda').show();"
                               oncomplete="jQuery('#loadingBusqueda').hide();"/>
            </a4j:commandButton>



            and a4j:form instead h:form.

            Regards,

            Tamas




            For the sake of my own curiosity.....Why will this fix the problem?


            Anyways, my own thoughts on the problem.


            My first question is why do you even have the a4j:support tag in that button. You are not using ajax. All you are doing is trying to hide and show a component. The problem here is that you have the a4j tag inside a h:commandButton which is going to do a full submit not an ajax call. And ultimately you really don't need the overhead of an ajax call as well.


            So, instead either use the rich:componentControl tag to show the loading panel OR just jam the javascript onto the onclick attribute of the h:commandButton itself.


            Now so far this doesn't actually explain the problem (well, I can't think of exactly why it would cause the problem anyways). So....


            Obviously the code not being in English is making it a little hard for me to understand completely but.... am I right in assuming that when you click the button the outcome is:


            return "/asegCalidadReportes/reporteVerificacionSRPorOrigen.xhtml";
            



            And what is the output from your logging in your generateReport action


            System.out.println("tipo local:"+tipo);
            System.out.println("tipo global:"+this.tipo);
            System.out.println("año:"+this.anoSeleccionado);
            System.out.println("semestre:"+this.semestreSeleccionado);
            System.out.println("mes:"+this.mesSeleccionado);