I hope you can help me I am trying to make me return a list from the database through a resultset but I can not get it I hope you can help me thank you
public ArrayList<BeanNivelLlenado> consultarNivel(){
ArrayList<BeanNivelLlenado> niveles=new ArrayList<BeanNivelLlenado>();
try {
conn=this.getConexion();
st=conn.createStatement();
rs=st.executeQuery("select * from nivel;");
ResultSetMetaData md = rs.getMetaData();
int columns = md.getColumnCount();
while (rs.next()) {
HashMap row = new HashMap();
niveles.add(row);
for(int i=1; i<=columns; i++){
row.put(md.getColumnName(i),rs.getObject(i));
}
return niveles;
}
this.cerrarConexion();
} catch (Exception e) {
e.printStackTrace();
// TODO: handle exception
}
return niveles;
}
is a select of an html and I would like to know what the error would be, by calling that filled list
<%
ArrayList<BeanNivelLlenado> listaNivel= (ArrayList<BeanNivelLlenado>)request.getAttribute("listaNivel");
%>
<SELECT NAME="selNivel" SIZE=1 style="width:120px;text-align:center;">
<OPTION>Seleccione</OPTION>
<%for(BeanNivelLlenado nivel: listaNivel){%>
<option ><%= nivel.getNivel()%></option>
<%} %>
</SELECT>