title: returning multiple values in web service
body: <p>I am designing a web-service using java and eclipse which returns the user details who are marked as customer in the database</p>
  
  <p>I was successfully able to return details for a single user (as there was only one entry in the dB) with the following code:</p>
  
  <pre><code>public class GetData {
  
  public LoginDetails getDetails(){    
      Connection conn;
      Statement stmt;
      ResultSet rs;
  
      try {
          LoginDetails lds=new LoginDetails();
          Class.forName(driver);
          conn=DriverManager.getConnection(url,username,password);
          stmt=conn.createStatement();
          String sql="select * from login where usertype='customer'";
          rs=stmt.executeQuery(sql);
          while(rs.next()){
              lds.setUsername(rs.getString(1));
              lds.setPassword(rs.getString(2));
              lds.setUsertype(rs.getString(3));
              lds.setActive(rs.getString(4));
  
          }
          return lds;
      } 
      catch(ClassNotFoundException c){
          c.printStackTrace();
      }
      catch (SQLException e) {
          e.printStackTrace();
      }
  
      return null;
  }
  }
  </code></pre>
  
  <p>What should I do if there are multiple values in dB matching the criteria and I want to display them all. Please advice.</p>