I need to create a drop-down list in jsp with a query made in mysql I am working with mvc attached the servlet where I have the data of the query but I could not send the data to the drop-down list and also attached the jsp page.
Can you tell me how this can be done?
SeleccionarFechasDao dao = new SeleccionarFechasDao();
dao.CargarDatos();
ResultSet res = dao.CargarDatos();
List<GenerarFechas> fechas = new ArrayList<>();
try {
while (res.next()) {
/* codigo para agregar fechas */
}
} catch (SQLException ex) {
Logger.getLogger(SeleccionarFechas.class.getName())
.log(Level.SEVERE, null, ex);
}
request.getSession().setAttribute("GenerarFechas", fechas);
request.getRequestDispatcher("consulta.jsp").forward(request, response);
And here is where the mysql query should go in the drop-down list
<label for="Fecha">Fecha</label>
<select type="text" name="Fecha" class="form-control" size="9"
placeholder="Mes.Año" required="true">
<!-- options -->
</select>