this is the part of the jsp in which I do the validations
<%@page import="Consultas.DAO_FINALCOMPLE"%>
<%@page import="clases.FIANL_COMPLE"%>
<!-- begin snippet: js hide: false console: true babel: false -->
<%@page import="java.sql.*"%>
<%
boolean Enviar = false;
boolean Limpiar = false;
boolean consultar = false;
boolean Editar = false;
if (request.getParameter("Enviar") != null) {
Enviar = true;
}
if (request.getParameter("Limpiar") != null) {
Limpiar = true;
}
if (request.getParameter("consultar") != null) {
consultar = true;
}
if (request.getParameter("Editar") != null) {
Editar = true;
}
String mensaje = "";
String numinfo_infoFINALcomple = "";
String tipo_info = "";
String resul_infoFINALcomple = "";
String subir_infoFINALcomple = "";
if (request.getParameter("numinfo_infoFINALcomple") != null) {
numinfo_infoFINALcomple = request.getParameter("numinfo_infoFINALcomple");
}
if (request.getParameter("tipo_info") != null) {
tipo_info = request.getParameter("tipo_info");
}
if (request.getParameter("resul_infoFINALcomple") != null) {
resul_infoFINALcomple = request.getParameter("resul_infoFINALcomple");
}
if (request.getParameter("subir_infoFINALcomple") != null) {
subir_infoFINALcomple = request.getParameter("subir_infoFINALcomple");
}
if (Enviar) {
if (numinfo_infoFINALcomple == "") {
mensaje = "Dede ingresar el numero del informe";
} else if(tipo_info == ""){
mensaje= " Debe ingresar el numbre de la compañia";
}
else {
DAO_FINALCOMPLE DATOS = new DAO_FINALCOMPLE();//dao
FIANL_COMPLE miUsuario = DATOS.getID_INFO_FINAL_COMPLE(numinfo_infoFINALcomple);
//entidad
if (miUsuario != null) {
mensaje = "el informe ya existe";
} else {
// si es int new integwr(el campo)
miUsuario= new FIANL_COMPLE( numinfo_infoFINALcomple,
resul_infoFINALcomple,
tipo_info,
subir_infoFINALcomple);
DATOS.nuevoInfoC(miUsuario);
mensaje ="enviado";
}
DATOS.desconectar();
}
}
dao class that I do the query this is the idea that I have that depending on the type of report I keep in the table that has that name I do not know if the query if it can be done like this.
public void INFO_PRELI(FIANL_COMPLE miUsuario) {
try {
String sql = "insert into "+miUsuario.getTIPO_INFO+""
+ "VALUES (" +miUsuario.getID_INFO_FINAL_COMPLE()+ ","
+ "'" + miUsuario.getRESULTADO()+ "',"
+ "'" + miUsuario.getSUBIRCOMPLE()+ "'"
+")";
Statement stm = ConexionOracle().createStatement();
stm.executeUpdate(sql);
} catch (SQLException ex) {
Logger.getLogger(DAO_INFO_PRELI.class.getName()).log(Level.SEVERE, null, ex);
}
}
this is the entities class
public class FIANL_COMPLE {
String ID_INFO_FINAL_COMPLE;
String RESULTADO;
String TIPO_INFO;
String SUBIRCOMPLE;
public FIANL_COMPLE(String ID_INFO_FINAL_COMPLE, String RESULTADO, String TIPO_INFO, String SUBIRCOMPLE) {
this.ID_INFO_FINAL_COMPLE = ID_INFO_FINAL_COMPLE;
this.RESULTADO = RESULTADO;
this.TIPO_INFO = TIPO_INFO;
this.SUBIRCOMPLE = SUBIRCOMPLE;
}
public String getID_INFO_FINAL_COMPLE() {
return ID_INFO_FINAL_COMPLE;
}
public void setID_INFO_FINAL_COMPLE(String ID_INFO_FINAL_COMPLE) {
this.ID_INFO_FINAL_COMPLE = ID_INFO_FINAL_COMPLE;
}
public String getRESULTADO() {
return RESULTADO;
}
public void setRESULTADO(String RESULTADO) {
this.RESULTADO = RESULTADO;
}
public String getTIPO_INFO() {
return TIPO_INFO;
}
public void setTIPO_INFO(String TIPO_INFO) {
this.TIPO_INFO = TIPO_INFO;
}
public String getSUBIRCOMPLE() {
return SUBIRCOMPLE;
}
public void setSUBIRCOMPLE(String SUBIRCOMPLE) {
this.SUBIRCOMPLE = SUBIRCOMPLE;
}
}
I hope you can help me
thank you very much