Skip to content Skip to sidebar Skip to footer

Jsp Display Random Amount Of Rows From Database

I'm making a web-application with JSP and Servlets and I came accross this problem: I have a table users and a myeducations table. These table relationship is established on user_i

Solution 1:

You achieve this using joins or nested Query

As per your current DB Design, you can achieve this by a simple query itself, Since Education table holds the USER_ID

SELECT school_name FROM myeducation myedu where user_id="SOME_ID_HERE"

For looping String Array in servlet, simply do like this

ArrayList<String> arr = new ArrayList<String>();
while (rs.next()) {
  arr.add(rs.getString("school_name "));
}

Post a Comment for "Jsp Display Random Amount Of Rows From Database"