package tw.beans; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import tw.domain.Tag; public class GetWallBean { ConnectionBean conn; public GetWallBean() { conn = new ConnectionBean(); } public ArrayList getTags() { ResultSet rs = null; String q = "SELECT * FROM tagwall"; try { System.out.println(q); rs = conn.executeQuery(q); } catch (SQLException e) { System.out.println("Opstod fejl da der skulle hentes fra DB"); System.out.println(e); } ArrayList res = new ArrayList(); //res.add(new Tag("1", "2", "3")); System.out.println("første " + res.size()); try { while(rs.next()) { res.add(new Tag(rs.getString("poster"), rs.getString("title"), rs.getString("tag"))); System.out.println("while-size " + res.size()); } } catch (SQLException e) { System.out.println("Fejl ved behandling af resultset"); System.out.println(e); } return res; } }