Hello good afternoon friends, I hope and they are well, previously I had already asked in another occasion and because here I will write it again not to cause confusion, I have this java code that later I put it in a method that I did
public void eliminarProcesos(); {
String fechaMaximaFinal=null;
String fechaMaximaInicial=null;
String whereVAAC;
String whereVAACOpera;
try {
if(fechaMaximaInicial.startsWith("00")){
whereVAAC=" to_date(NB_FECHA,'DDMMYYYY') between to_date('01"+fechaMaximaInicial.substring(2)+"','DD/MM/YYYY') and to_date('"+fechaMaximaFinal+"', 'DD/MM/YYYY') ";
whereVAACOpera=" to_date(NB_FECHA,'DDMMYYYY') between to_date('01"+fechaMaximaInicial.substring(2)+"','DD/MM/YYYY') and to_date('"+fechaMaximaFinal+"', 'DD/MM/YYYY') ";
}else{
whereVAAC=" to_date(NB_FECHA,'DDMMYYYY') between to_date('"+fechaMaximaInicial+"','DD/MM/YYYY') and to_date('"+fechaMaximaFinal+"', 'DD/MM/YYYY')";
whereVAACOpera=" to_date(NB_FECHA,'DDMMYYYY') between to_date('"+fechaMaximaInicial+"','DD/MM/YYYY') and to_date('"+fechaMaximaFinal+"', 'DD/MM/YYYY')";
}
//Aqui es donde borra los registros de las tablas 54 y 49
this.genericDao.borrarRegistros("VivVAACOpera", whereVAACOpera);
this.genericDao.borrarRegistros("VivVAAC", whereVAAC);
}catch (Exception e){
logger.info("exception: " + e.getMessage());
}
}
that invokes a hibernate and that hibernate generates the delete statement, my main problem is as follows, how could you invoke that java method using a button in a jsp? this the code of my button I want, but I do not have an idea how to do it:
<input id="#" name="#" type="button" value="Borrar Proceso Completo" onclick="javascript:borrarAllProcesoVAAC();"/>
and as such this would be my javascript function
function borrarAllProcesoVAAC(){
document.getElementById.action="eliminarAllProcesoVaac"
document.getElementById.submit();
}
I have also contemplated doing it with a servlet
but I am not if it is necessary, it is the following:
public void eliminarAllProcesoVaac(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
}
I hope and you can help me with this problem, I remain on the side if it is not understood.
Best regards.