retrieve date from an ajax call in struts

2

I have to recover from java a date that is passed as a parameter in the url of the ajax call. The parameter in the URL from the ajax call gets it right, the problem comes from the java part that is null.

if(id=='A'){
                tipoFacturaV="A";
                newSerie=proponerNewSerie();
                url='/sgca/cabnom/duplicarFacturaAnulacion.action?tipoFacturaV='+tipoFacturaV+'&numNomDuplicado='+newNumNom+'&cabnom.tipoFacturaV=${cabnom.tipoFacturaV}&factCli.NFactura=${factCli.NFactura}&factCli.SFactura=${factCli.SFactura}&cabnom.numnom=${cabnom.numnom}&operation=new&factCli.cabnom.numnom=${factCli.cabnom.numnom}&factCli.FFactura=${factCli.FFactura}';
                alert(url);
            }
            else if(id=='S' || id=='I'){
                tipoFacturaV=id;
                newSerie=proponerNewSerie();

                //url='/sgca/producto/buscarModal.action';
                url='/sgca/cabnom/duplicarFacturaRectificacion.action?tipoFacturaV='+tipoFacturaV+'&numNomDuplicado='+newNumNom+'&cabnom.tipoFacturaV=${cabnom.tipoFacturaV}&factCli.NFactura=${factCli.NFactura}&factCli.SFactura=${factCli.SFactura}&cabnom.numnom=${cabnom.numnom}&operation=new&factCli.cabnom.numnom=${factCli.cabnom.numnom}&cabnom.motivoRx='+motivoRx+'';

            }
            $.ajax(url, {
                async:false,
                type:'post',
                success: function(data){
                    window.location='/sgca/cabnom/view_fact.action?operation=edit&pestanya=LINEASNOM'+'&cabnom.numnom='+newNumNom+ 
                    '&duplicada=true';

                },
                error: function(xhr, ajaxOptions, thrownError) {
                    alert("Se ha producido un error a la hora de duplicar la nominación.");
                }
            });

in the image I show the url. factCli.FFactura=2018-01-18 is the date that I have to recover from java. I show the calse java with the variable, its getter and setter

@TableAnnotation(tableName="FACTURA_VENTA")
public class FacturaVenta {
@ColumnAnnotation(colName="F_FACTURA")
private Date fFactura;
@TypeConversion (converter="com.sgca.web.converter.FechaConverter") 
public Date getFFactura() {
    return fFactura;
}
public void setFFactura(Date fFactura) {
    this.fFactura = fFactura;
  }
 }

and this is the action that is called from javascript, and where I have to retrieve the date.

public String duplicarFacturaAnulacion(){
    System.out.println("llamando al metodo duplicarFacturaAnulacio del action ");
    int numNomAnterior = this.getCabnom().getNumnom();
    this.cabnom = this.cabNomService.read(this.cabnom.getNumnom());
    this.buscarLineasNom();
        //S_FACTURA_ORI
        this.cabnom.setSFacturaOri(factCli.getSFactura());
        //N_FACTURA_ORI
        this.cabnom.setNFacturaOri(factCli.getNFactura());
        //TIPO_FACTURA_V
        this.cabnom.setTipoFacturaV(tipoFacturaV);
        //F_FACTURA_ORI
        this.cabnom.setFFacturaOri(factCli.getFFactura());//factCli.getFFactura() null
}

factCli.getFFactura() is null , but in the URL if it recovers it.

The rest of parameters that I pass in the URL of the call ajax I get without problems, however, the date is null. I do not know if I have to do some parsing of the date from java to retrieve it. Any ideas?

    
asked by miss Robot 24.01.2018 в 10:33
source

0 answers