Servlet: request.getReader () null in the GET method

0

I have a Servlet that reads the Form with getReader () but for some reason it returns null.

HTML:

body>
    <form action="Controlador">
        Hotel:

        <!--<input type = "submit" value = "Submit" />-->

        <select  id="hoteles" name="hoteles" id="hoteles">

            <option value="1">HollydayInn</option>
            <option value="2">Sheraton</option>
            <option value="3">CincoEstrellas</option>
            <option value="4">CuatroEstrellas</option>
            <option value="5">DosEstrellas</option>

        </select>
        <br>
        <br>
        Numero de Noches:
        <br>
        <br>

        <input type="number" name="numNoches" id="numNoches">
        <br>
        <br>
        Tipo de Habitacion:
        <br>
        <br>
        <select id="tipHab" name="tipHab" id="tipHab">

            <option value="camasimple ">Cama Simple</option>
            <option value="camadoble">Cama Doble</option>
            <option value="doscamasdoble">Dos Camas Dobles</option>


        </select>
        <br>
        <br>
        Fecha de Llegada:
        <br>
        <br>
        <input type="date" name="fechallegada" id="fechallegada">
        <br>
        <br>
        Menores de dos años:
        <br>
        <br>
        <input type="number" min="0" name="numMenores" id="numMenores">
        <br>
        <br>
        Menores de doce años:
        <br>
        <br>
        <input type="number" min="0" name="numMenoresdoce" id="numMenoresdoce">
        <br>
        <br>
        Adultos:
        <br>
        <br>
        <input type="number" min="0" name="numadultos" id="numadultos">
        <br>
        <br>
        <input class="estilo" type="button" onclick="loadDoc()" value="Obtener Precio" >
        <input class="estilo" type="submit"  value="Redireccion" >



        <!--cambie el type="button" por el type="submit" y le quite el atributo  onclick  -->
        <br>

        <!--<button onclick="">Try it</button>-->
    </form>

Servlet:

PrintWriter out = response.getWriter();
        String texto = request.getReader().readLine();
        System.out.println(texto);
        TarifaDAOImp tarifa = new TarifaDAOImp(texto);
        tarifa.insertarDatos("INSERT INTO T_tarifa (precioNoche, fechaInicio, fechaFin, tarifa , codHotel, tipoHab) values ((SELECT precio  FROM T_tiphab  where codHotel= ? and tipo= ?), ? ,( ? + interval ? day), ?  * (select precio from T_tiphab where tipo= ? and codHotel= ?), ?, ?)");
        out.print("sss");
    
asked by TOMAS 21.07.2018 в 19:10
source

0 answers