View Single Post
  #1 (permalink)  
Old 05-12-2008, 09:40 AM
am17mu am17mu is offline
Member
 
Join Date: Feb 2008
Posts: 2
am17mu is on a distinguished road
<tr><td> arrangement in a method
Hi EveryOne,

I have this code, which is used to access, a table from the database (postgresql) and is used to display 5 attributes, with all data, in the following format

JudgeId Name Designation Address Active Status
1 *** *** *** ***
2 *** *** *** ***
.
.
. as follows

the code i have writen is as follows

Code:
String Qry= "SELECT \"JUDGEID\",\"NAME\",\"DESIGNATION\",\"ADDRESS\",\"ACTIVE_STATUS\" FROM \"Tax\".\"JUDGES\""; rset= stmt.executeQuery(Qry); while(rset.next()){ list.add(rset.getString(1)); list.add(rset.getString(2)); list.add(rset.getString(3)); list.add(rset.getString(4)); list.add(rset.getString(5)); } /*this for loop, works fine for 2 elements,but for 5 elements, as above it does not display properly. */ for(int i=0;i<list.size();i++){ if(i==0 || i%2==0){ list.set(i,"<tr><td align='center'>"+list.get(i)+"</td>"); }else{ list.set(i,"<td align='center'>"+list.get(i)+"</td></tr>"); } }
*******************************************
I know, the problem lies within the if code, something with the <tr><td>
But can't seem to make it work
Please help guys
Thanks in advance
am17mu
Reply With Quote
Sponsored Links