populate jsp drop down with database info
- by Cano63
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;
} '