6 Replies Latest reply on Aug 12, 2011 11:54 AM by Carlos Celis Osorio

    Error setting a Date type parameter [solved]

    Carlos Celis Osorio Newbie

      Hi there.

       

      I am trying to set a Date type parameter to a report through the next code:

       

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html 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:s="http://jboss.com/products/seam/taglib"
                xmlns:rich="http://richfaces.org/rich"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:birt="http://www.eclipse.org/birt/taglibs/birt.tld"
          xmlns:b="http://jboss.com/products/seam/birt">
      
      
      <ui:composition template="/layout/template.xhtml">
                <ui:define name="body">
                          <h:form id="homeForm">
                                    <rich:panel id="panel_config_report">
                                              <f:facet name="header">
                                                        <h:outputText value="Reportes - Distribución" />
                                              </f:facet>
                                              <table align="center">
                                                        <tr align="center">
                                                                  <td><h:outputLabel value="Fecha Inicio:" /></td>
                                                                  <td>
                                                                            <rich:calendar id="fecha_inicio" datePattern="yyyy/MM/dd"
                                                                                      locale="CO" popup="true" enableManualInput="false"
                                                                                      value="#{report.report.fechaInicio}" />
                                                                  </td>
                                                                  <td><h:outputLabel value="Fecha Fin:" /></td>
                                                                  <td>
                                                                            <rich:calendar id="fecha_fin" datePattern="yyyy/MM/dd"
                                                                                      locale="CO" popup="true" enableManualInput="false"
                                                                                      value="#{report.report.fechaFin}" />
                                                                  </td>
                                                                  <td><h:outputLabel value="Zona:" /></td>
                                                                  <td>
                                                                            <h:selectOneMenu id="zona" value="#{report.report.zona}">
                                                                                      <s:selectItems value="#{tblDistribucionUsuariosMovilList.resultList}"
                                                                                                var="user" itemValue="#{user.usuario}" label="#{user.usuario}"
                                                                                                noSelectionLabel="---SELECCIONE---" />
                                                                            </h:selectOneMenu> 
                                                                  </td>
                                                                  <td><h:outputLabel value="Tipo Reporte:" /></td>
                                                                  <td>
                                                                            <h:selectOneMenu id="tipo_reporte" value="#{report.report.tipoEnvio}">
                                                                                      <s:selectItems value="#{tblValorMaestroList.resultList}"
                                                                                                var="master" itemValue="#{master.nombre}" label="#{master.descripcion}"
                                                                                                noSelectionLabel="---SELECCIONE---" />
                                                                            </h:selectOneMenu> 
                                                                  </td>
                                                        </tr>
                                                        <tr>
                                                                  <td colspan="8" align="center">
                                                                            <h:commandButton action="#{report.generateReport()}" value="Generate" />
                                                                  </td>
                                                        </tr>
                                              </table>
                                    </rich:panel>
                                    <rich:panel id="report" rendered="#{report.report.fechaFin != null and report.report.fechaInicio != null and report.report.zona != null and report.report.tipoEnvio != null}">
                                              <f:facet name="header">
                                                        <h:outputText value="Report BIRT" />
                                              </f:facet> 
                                              <b:birt embeddable="true" designName="distribution/design/reporteSinDetalle.rptdesign">
                                                        <b:param name="FechaInicio" value="#{report.report.fechaInicio != null ? report.report.fechaInicio : '0'}" />
                                                        <b:param name="FechaFin" value="#{report.report.fechaFin != null ? report.report.fechaFin : '0'}" />
                                                        <b:param name="Zona" value="#{report.report.zona != null ? report.report.zona : ''}" />
                                                        <b:param name="TipoReporte" value="#{report.report.tipoEnvio != null ? report.report.tipoEnvio : ''}" />
                                              </b:birt>
                                    </rich:panel>
                          </h:form>
                </ui:define>
      </ui:composition>
      </html>
      

       

       

      Dates values arrive to class ReporteBackingBean.java (its nickname is "report") but, when they arrive to the report, console shows the next error:

       

       

      GRAVE [org.jboss.tools.birt] the value of parameter FechaInicio is invalid: org.eclipse.birt.core.exception.CoreException: Can not convert the value of Mon Aug 01 00:00:00 COT 2011 to Date type.
      

       

       

      The ReporteBackingBean.java class has a method that starts a conversation and other that finishes it. Also, It has an object of the Report.java class.

      The code of the Report.java class is the next:

       

       

      @Entity
      public class Report {
                private Date fechaInicio;
                private Date fechaFin;
                private String zona;
                private String tipoEnvio;
      
                /**
                 * @return the fechaInicio
                 */
                public Date getFechaInicio() {
                          return fechaInicio;
                }
                /**
                 * @param fechaInicio the fechaInicio to set
                 */
                public void setFechaInicio(Date fechaInicio) {
                          this.fechaInicio = fechaInicio;
                }
                /**
                 * @return the fechaFin 
                 */
                public Date getFechaFin() {
                          return fechaFin;
                }
                /**
                 * @param fechaFin the fechaFin to set
                 */
                public void setFechaFin(Date fechaFin) {
                          this.fechaFin = fechaFin;
                }
                /**
                 * @return the zona
                 */
                public String getZona() {
                          return zona;
                }
                /**
                 * @param zona the zona to set
                 */
                public void setZona(String zona) {
                          this.zona = zona;
                }
                /**
                 * @return the tipoEnvio
                 */
                public String getTipoEnvio() {
                          return tipoEnvio;
                }
                /**
                 * @param tipoEnvio the tipoEnvio to set
                 */
                public void setTipoEnvio(String tipoEnvio) {
                          this.tipoEnvio = tipoEnvio;
                }
      }
      

       

       

      Can you help me?

       

      Thanks in advance.