How can I print many records from an Array?

Hello people,
I am developing a web application using JSPs. Now I have a problem with a checked boxes. I am able to
put checked boxesin array, but when I want to print it is just printing one record even if I have selected more than one record. My code is below? How can I achieve this?

String driver ="";
String url = "jdbc:mysql://localhost:3306/db2";
String username = "root";
String password = "yhhnmm";	
	 String sql =null;	
	 //ResultSet rs =null;					
  try {
	 //Connection con = DriverManager.getConnection(url,username,password); 
	  Connection con = DriverManager.getConnection(url,username,password);
	 System.out.println("got connection"); 

  SelectedTrans = request.getParameterValues("SelectedTrans");
    Statement s = con.createStatement(); 
	for (int i = 0; i < SelectedTrans.length; i++) 

   sql = "SELECT number,amount,date,type,year,serial,cuoCod,nber FROM sad_gen2 where number ='"+ SelectedTrans[i] +"'"; 
 ResultSet rs = s.executeQuery(sql); 
  while ( {
    System.out.println(rs.getString(1) + " " + rs.getString(2)); 
	System.out.println(rs.getString(3) + " " + rs.getString(4));
	System.out.println(rs.getString(5) + " " + rs.getString(6));
	System.out.println(rs.getString(7) + " " + rs.getString(8));
String amount =rs.getString(2);
String type =rs.getString(4);
String year = rs.getString(5);
String serial =rs.getString(6);
String cuo_cod =rs.getString(7);
String nber =rs.getString(8);


                                <table width="96%" border="1" cellspacing="0" cellpadding="0">
                                    <td width="12%"><% String valueto=rs.getString(1);
									out.println(valueto);  %></td>
                                    <td width="12%"><% String valueto2=rs.getString(2);
									out.println(valueto2);  %></td>
                                    <td width="12%"><% String valueto3=rs.getString(3);
									out.println(valueto3);  %></td>
                                    <td width="12%"><% String valueto4=rs.getString(4);
									out.println(valueto4);  %></td>
                                    <td width="12%"><% String valueto5=rs.getString(5);
									out.println(valueto5);  %></td>
                                    <td width="12%"><% String valueto6=rs.getString(6);
									out.println(valueto6);  %></td>
                                    <td width="12%"><% String valueto7=rs.getString(7);
									out.println(valueto7);  %></td>
                                    <td width="6%"><% String valueto8=rs.getString(8);
									out.println(valueto8);  %></td>
                                    <td width="10%"><c:out value="${serviceResult.rcpYear}/${serviceResult.rcpSerial}/${serviceResult.rcpNber}"/></td>
  catch (Exception e) {