help my servlet does not work for me

0

Hello everyone I'm creating a project that saves a form in the database before I worked everything now no servlet works but no error comes out

jsp

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.sql.*" %>
<%--<%
    
 HttpSession objSession = request.getSession(false);
 String usuario =(String)objSession.getAttribute("usuario");
 if(usuario.equals("")){
     response.sendRedirect("index.jsp");
 }
%>--%>

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
     <body>
        <form name="infoFINAL" action="FINAL" method="post" id="infofinal">
            <table border="0" align="center">
          <center>
        <h1>Informe final</h1>
    </center>

                <tbody>
                    
                    <tr>
                        <td>Numero de informe</td>
                        <td><input type="text" name="numinfo_infoFINAL" value="" size="20" /></td>
                        <td>Compañia</td>
                        <td><input type="text" name="compa_infoFinal" value="" size="20" /></td>
                    </tr>
                    <tr>
                        <td>Rsulado</td>
                        <td><input type="text" name="resul_infoFINALe" value="" size="20" /></td>
                        <td>Subir informe</td>
                        <td><input type="text" name="subir_infoFINAL" value="" size="20" /></td>
                    </tr>
                <td>  <input type="text" name="encargado"id="encargado" value="<%-- <% out.println(usuario);%>--%>" size="20" DISABLED /></td>
               
                     <tr>
                        <td><input type="submit" value="Enviar" /></td>

                    </tr>
                    <a href="http:// http://localhost:2016/WebApplication3/ver_info_final.jsp">ver info</a>
                </tbody>
            </table>
        </form>
    </body>

</html>

SQL ORACLE



package Consultas;

import clases.ConexionOracle;
import clases.FINALINFO;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import oracle.security.o3logon.C0;

public class DAOINFOFINLA extends ConexionOracle {

public boolean INFOFINAL(String COMPAÑIA, int ID_INFO_FINAL, String RESULTADO, String SUBIRINFO, String ENCARGADO) {
    PreparedStatement stm = null;
    try {
        String INFORMEFINAL = "insert into  INFO_FINAL (COMPAÑIA, ID_INFO_FINAL,SUBIRINFO,RESULTADO,ENCARGADO) VALUES (?,?,?,?,?)";

         stm = ConexionOracle().prepareStatement(INFORMEFINAL);

        stm.setString(1, COMPAÑIA);
        stm.setInt(2, ID_INFO_FINAL);
        stm.setString(3, SUBIRINFO);
        stm.setString(4, RESULTADO);
        stm.setString(5, ENCARGADO);
        if (stm.executeUpdate() == 1) {
            return true;
        }

    } catch (Exception e) {

        System.err.println("errorrr" + e);
    } finally {
        try {
            if (getConnection() != null) {
                getConnection().close();
            }
            if (stm != null) {
                stm.close();
            }
        } catch (Exception e) {
            System.err.println("errorrr 2" + e);
        }
    }

    return false;
}
public static void main(String[] args) {
    DAOINFOFINLA N = new DAOINFOFINLA();
    System.out.println(N.INFOFINAL("in", 2018-7, "bnnn", "mqnqn", "yopp"));
}
}





servlet 

package servler;

import Consultas.DAOINFOFINLA;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author luisa
 */
public class INFOfinal extends HttpServlet {

    /**
     * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
     * methods.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        
        PrintWriter out = response.getWriter();
     
        
        String numinfo_infoFINAL = request.getParameter("numinfo_infoFINAL");
        String compa_infoFinal = request.getParameter("compa_infoFinal");
        String resul_infoFINAL = request.getParameter("resul_infoFINAL");
        String subir_infoFINAL = request.getParameter("subir_infoFINAL");
        String encargado = request.getParameter("encargado");
             DAOINFOFINLA FINAL = new DAOINFOFINLA();
        
        if (FINAL.INFOFINAL(subir_infoFINAL, 0, resul_infoFINAL, compa_infoFinal,encargado)) {
            
            response.sendRedirect("index.jsp");
  } else{ 
        response.sendRedirect("REGISTRO.jsp");
        }
    }

    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
    /**
     * Handles the HTTP <code>GET</code> method.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }

    /**
     * Handles the HTTP <code>POST</code> method.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }

    /**
     * Returns a short description of the servlet.
     *
     * @return a String containing servlet description
     */
    @Override
    public String getServletInfo() {
        return "Short description";
    }// </editor-fold>


}

When I run and fill out my form, it directs me to Registro.jsp and it does not save me in the database. I do not know what I have wrong. I have the web.xml and I have the names in the right place. I hope you can help me.

    
asked by luisa suaza 22.06.2018 в 22:26
source

1 answer

0

From what little I see, it seems to me that you changed the name of your servlet or something similar, maybe it would be useful to work with "JSTL" - > Small tutorial

    
answered by 23.06.2018 в 04:29