package myfds; import java.util.ArrayList; import java.util.List; import java.sql.*; public class MyService { public List getProducts() { List list = new ArrayList(); /*MyBean(int myid, String lastName, String firstName, String prodID) For a real database connection example, you may do something like the following: Connection c = null; try { c = ConnectionHelper.getConnection(); Statement s = c.createStatement(); ResultSet rs = s.executeQuery("SELECT * FROM product ORDER BY name"); while (rs.next()) { list.add(new Product(rs.getInt("product_id"), rs.getString("name"), rs.getString("description"), rs.getString("image"), rs.getString("category"), rs.getDouble("price"), rs.getInt("qty_in_stock"))); } } catch (SQLException e) { e.printStackTrace(); throw new DAOException(e); } finally { ConnectionHelper.close(c); } */ try { list.add(new MyBean(1,"lin", "lin","12")); list.add(new MyBean(2,"John", "Zhao","120")); }catch(Exception e){ e.printStackTrace(); } return list; } public MyBean getProduct(int myid) { MyBean bean = new MyBean(); bean.setMyid(1); bean.setFirstName("lin"); bean.setLastName("lin"); bean.setProdID("12"); return bean; } }