brian madden

brian madden

  • NA
  • 1
  • 1.7k

Using id's from an arraylist to access columns on a database

Mar 2 2013 12:13 PM

Hi, I am working on an admin site where the user can view the list of employees displayed  from a database in a jsp form. The project uses java classes and servlets. In the form is the employees details as well as a check box with a value set to the employeeID (primary key in the database). 

[code] <input type="checkbox" value="${employee.empID}" name="empArray">v[/code]

 Say I select 8 employee's I can pass their values back to the servlet and store them in an array list and print them. What I am struggling to achieve now is to use the empID's in the array list to access their matching  values in a database so I can create a table of the employees based on the id's stored in the array list.

In other words if   String[] empArray contains employee id's "5,7,9,20 ...etc" I want to be able to display their details in a new table so I can export the data for reports. Can anyone advise me on the best way to go about this?