By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,798 Members | 1,336 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,798 IT Pros & Developers. It's quick & easy.

how can i get the selected rows from 1 HTML Table, to another HTML Table

P: 1
i am fetching table data (2 columns)from database in my JSP Page, There, my first column is checkbox
Now as checkbox is checked, that particular row should be selected and should be dislpayed in another
table, which is on the same page.
I am using ArrayList to get selected rows but i am not able to get whole data which is selected but only one row i am getting
Moreover its giving NULLPOINTEREXCEPTION, my code id like this
please help me to find out why ArrayList is not working

Expand|Select|Wrap|Line Numbers
  1. try {     
  2.  
  3.             conn = DBConnect.getConnection();
  4.               statement = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
  5.             rs1= statement.executeQuery("SELECT VENDORNAME,VENDORCODE from vew_VENDORS WHERE  VENDORNAME LIKE '"+searchVenId+"%' ORDER BY VENDORNAME");
  6.  
  7. while(rs1.next()) 
  8.                                 {
  9.                                  %>
  10.                                 <TR><td width="50"><INPUT type="checkbox" name="venSelect" value="selectven"></TD><TD id="venName[]" width="145"/>
  11.                                 <%=rs1.getString("VENDORNAME")%></TD><TD id="venCode[]" width="145"><%=rs1.getString("VENDORCODE")%></TD></TR>
  12.                                 <%    } 
  13.     <%  a1.add(rs1.getString("VENDORNAME"));            System.out.println("ArrayList.........");
  14.  
  15.     for(int i=0;i<a1.size();i++)
  16.     {
  17.     itr1=a1.iterator();
  18.     while(itr1.hasNext())
  19.     {
  20.      s1 = (String[])itr1.next();
  21.     for(j=0;j<s1.length;j++)
  22.     {
  23.                System.out.println("s1[j]="+s1[j]);
  24.     }
  25.     }
  26.     }%>                        
  27.                <%}
  28. catch(Exception e)
  29. {
  30. e.printStackTrace(System.out);
  31. }
Dec 15 '06 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.