查询出数据的处理 做一个值对象将查询出来的数据封装到值对象中然后将这些值对象放到一个List中返回给jsp 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 返回一个COLLECTION比较好,ARRAYLIST用的多。 值对象:public class ResVO { private String id; private String name; public void setId(String id) { this.id = id; } public String getId() { return this.id; } public void setName(String name) { this.name = name; } public String getName() { return this.name; } public boolean equals(Object obj) { boolean flg = false; if (this.getId() != null && (obj instance of ResVO)) { ResVO vo = (ResVO) obj; if ( this.getId.equals( vo.getId() ) ) { flg = true; } } return flg }}使用:public List findPerson(...) { ...... ResVO vo = new ResVO(); ArrayList array = new ArrayList(); while(rs.next()) { vo.setId(rs.getString("id")); vo.setId(rs.getString("name")); array.add(vo); } ......} ([^=\t]+)=([^\t]*)是什么意思 关于usebean的问题 jar命令总是出现错误!高手们帮忙! write(byte[] b, int off, int len) 将指定 byte 数组中从偏移量 off 开始的 len 个字节写入此输出流 string数组哪里有问题? 高分求java下栽 JAVA中有没有现成的类可直接写XML 找不到符号 关于javabean的使用问题! 请问:在Jbuilder4.0中,APPLET怎样访问数据库(以ACCESS为例)? 关于WIN98、2000、XP及2003的关机代码 在JAVA中写法一样吗? 写一个SQL语句,在线等,大伙帮帮忙!
public class ResVO {
private String id;
private String name;
public void setId(String id) {
this.id = id;
}
public String getId() {
return this.id;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return this.name;
}
public boolean equals(Object obj) {
boolean flg = false;
if (this.getId() != null && (obj instance of ResVO)) {
ResVO vo = (ResVO) obj;
if ( this.getId.equals( vo.getId() ) ) {
flg = true;
}
}
return flg
}
}
使用:
public List findPerson(...) {
......
ResVO vo = new ResVO();
ArrayList array = new ArrayList();
while(rs.next()) {
vo.setId(rs.getString("id"));
vo.setId(rs.getString("name"));
array.add(vo);
}
......
}