Pass a value from my database to a select in a form


I am working with JSP, Servlets and SQlite using the MVC pattern, in eclipse.

I explain what I'm doing, I have a page that lists a series of records and shows them in a table (all right up there)

I am using JSTL, a servlet returns an array called "listDisplay" and I have its values filled in the table

<!-- Cuerpo de la tabla  -->
              <c:forEach var="denuncia" items="${listarDenuncia}"><!-- Recogiendo el array listarDenuncia mandado por el servlet -->
                    <td style="background: #D9E5F5">

                    <!-- Boton que me permite escoger una denuncia de la lista -->
                    <form action="AgregarDenunciaServlet" method="post">
                        <input type="hidden" name="op_servlet" value="mostrar">
                        <div class="input-group-btn">
                            <button type="submit" class="btn btn-default" name="num_denuncia" value="${denuncia.num_denuncia}"><i class="fa fa-search"></i></button>
                    <!-- Fin  Boton que me permite escoger una denuncia de la lista -->

                    <!--  Llenando datos de los objetos en la tabla con JSTL -->
                    <td style="background: #D9E5F5"><c:out value="${denuncia.num_denuncia}"/></td>
                    <td style="background: #D9E5F5"><c:out value="${denuncia.num_doc_denunciado}"/></td>
                    <td style="background: #D9E5F5"><c:out value="${denuncia.nom_razon_social_denunciado}"/></td>
                    <td style="background: #D9E5F5"><c:out value="${denuncia.detalle_denuncia}"/></td>
                    <td style="background: #D9E5F5"><c:out value="${denuncia.estado_intranet}"/></td>

          <!-- Fin de la tabla -->

The code above works perfect, now when you click on the magnifying glass this data must be passed to a form that I have in the lower part and its fields are completed.

the fields that are input I find it easy to pass the values, for example for the number of complaints I only put a value to the value

<label>Numero de Denuncia</label>
              <input type="text" class="form-control" id="input_num_denuncia" name="num_denuncia" value="${denuncia.num_denuncia}">

What I can not do is pass the values to the select, for example that the Denominated Tipo.Doc select completes with some of the values.

Some way to do it with JSTL using the expressions

asked by angelo1793 08.11.2018 в 18:58

0 answers