title: JSP Multiple SQL Selects
body: <p>I am getting familiar with Java through involvement on a servlet web service project that is now up and running.  But the stakeholders want a front end that will allow them to examine the audit table set up in a SQL server database.  I am trying to quickly put one together in JSP with initial success but now stuck.</p>
  
  <p>I want a drop down list to provide a list of all the users (Unique).  I have acheived this using a JSTL taglib method following the link below with the following SQL;</p>
  
  <pre><code>"SELECT DISTINCT(USER_ID) FROM AUDIT_MESSAGE".
  </code></pre>
  
  <p><a href="http://www.apekshit.com/t/205/JSTL-SQL-Query-Tag-Example" rel="nofollow noreferrer">http://www.apekshit.com/t/205/JSTL-SQL-Query-Tag-Example</a></p>
  
  <p>Now I want, when the user clicks on one of the users names it automatically populates another drop down list with a list of times that user logged in with the following SQL;</p>
  
  <pre><code>SELECT SESSION_ID, EventTIME FROM dbo.AUDIT_MESSAGE
  WHERE OPERATION = 'loginResponse' AND RESULTS = 'OK'
  AND USER_ID = 'firstdropdownlistselection'
  </code></pre>
  
  <p>Then when an item from the second drop down list option is selected a third SQL statement of;</p>
  
  <pre><code>Select * FROM dbo.AUDIT_MESSAGE
  WHERE SESSION_ID = 'seconddropdownlistselection'
  </code></pre>
  
  <p>This is then used to populate a list box of the Users events at the selected time.</p>
  
  <p>I have found the following link below offering another method but I am unsure whether to continue with the method I have started with or is there a better way.  Can someone please advise me on what method would work best?</p>
  
  <p><a href="https://stackoverflow.com/questions/20687249/multiple-resultsets">Multiple ResultSets</a></p>
  
  <p>Thanks in advance</p>
  
  <p>AJF</p>