populate jsp drop down with database info

Posted by Cano63 on Stack Overflow See other posts from Stack Overflow or by Cano63
Published on 2010-05-25T00:13:26Z Indexed on 2010/05/25 0:21 UTC
Read the original article Hit count: 648

Filed under:

Hello, people, i,m looking for the way to populate a jsp dropdown. I want that when the jsp load it fill the dropdown with the info that i have in a database table.

Down I,m icluding the code of my class that will create the array and fill it with the database info. Whant i don,t know is how to call that class from my jsp and fill the dropdown.

'// this will create my array public static ArrayList getBrandsMakes() { ArrayList arrayBrandsMake = new ArrayList();

while(rs.next()) {
arrayBrandsMake.add(loadOB(rs)); // CARGO MI ARREGLO CON UN OBJETO

} return arrayBrandsMake;

} }

//this will load my array object private static DropDownBrands loadOB(ResultSet rs)throws SQLException {

DropDownBrands OB = new DropDownBrands ();

OB.setBrands("BRAN");

return OB; } '

© Stack Overflow or respective owner

Related posts about jsp