我正在尝试检索数据库中的所有元素并显示在网页中。但是使用我的代码它只能检索一个行元素。问题是,它检索所有元素,但将最后一行元素添加到对象中。我认为首先检索到的所有元素都被覆盖,因为它显示最后一行元素。谁能告诉我如何将所有行元素添加到 JSON 对象。请帮我。
代码 :
while(rs.next()){
ImageFile.setName(rs.getString("imagename").trim());
ImageFile.setDisc(rs.getString("imagedisc").trim());
ImageFile.setImageid(rs.getInt("imageid"));
ImageFile.setalbumid(rs.getInt("albumid"));
byte imageData[] = rs.getBytes("imagethumb");
String encoded = DatatypeConverter.printBase64Binary(imageData);
ImageFile.setThumb(encoded);
byte image1Data[] = rs.getBytes("imagethumb");
String encoded1 = DatatypeConverter.printBase64Binary(image1Data);
ImageFile.setFull(encoded1);
}
完整的源代码在这个问题中
请帮助我............谢谢......