我创建了一个javabean ,在其上建了一个student类:
package com.student.bean;
public class student {
private String sno;
private String sname;
private String ssex;
private String sage;
private String sdept;
public String getSno() {
return sno;
}
public void setSno(String sno) {
this.sno = sno;
}
public String getSname() {
return sname;
}
public void setSname(String sname) {
this.sname = sname;
}
public String getSsex() {
return ssex;
}
public void setSsex(String ssex) {
this.ssex = ssex;
}
public String getSage() {
return sage;
}
public void setSage(String sage) {
this.sage = sage;
}
public String getSdept() {
return sdept;
}
public void setSdept(String sdept) {
this.sdept = sdept;
}
}
我在servlet中这样用时:student stu=new student();
stu.setSno(rs.getString(2));
stu.setSname(rs.getString(2));
stu.setSsex(rs.getString(3));
stu.setSage(rs.getString(4));
stu.setSdept(rs.getString(5));
listStu.add(stu);
rs.getString()是我从数据库中取出的数据;
却显示错误:the method setXXX() is undefined for the type student.就算我这样改stu.setSdept(“abc");都还是一样错,是怎么回事啊?哪位大侠能帮我解决下,我初学者。
------解决方案--------------------
哦,自己解决了?恭喜,接分