public class AreaCodeBean extends ActionForm {
private Collection beanCollection = null;
private ArrayList categories = null;
private Collection acCollection = null;
private ArrayList aclist = null;
public ArrayList getAreacodes() {
Connection conn = null;
if (aclist == null) {
ArrayList
try {
conn = DBSettings.getConnection();
PreparedStatement ps = conn.prepareStatement("select ac from areacodes");
ResultSet rs = ps.executeQuery();
int i = 0;
while (rs.next()) {
entries.add(new LabelValueBean(rs.getString("ac"), rs.getString("ac")));
}
rs.close();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
aclist = entries;
}
return aclist;
}
1 comment:
Good post.
Post a Comment