出错的地方:
public ArrayList<Queshu> list() {
ArrayList<Queshu> queshus = new ArrayList<Queshu>();
List <String> datas=FileUtils.readLines("D:\\zuopin\\queshu.txt");
for(String data :datas){
String temp[]=data.replaceAll("\"","").split(",");
Queshu queshu = new Queshu(temp[0],temp[1],temp[2],temp[3],temp[4],temp[5],temp[6],temp[7],temp[8]);
queshus.add(queshu);
}
return queshus;
}
package vo;
/**
*
* @author Administrator
*/
public class Queshu {
private int quesuid ;//编号
private String shu_name;//缺书书名
private String banshe;//缺书出版社
private String zuozhe;//作者
private String chuban_date;//出版日期
private String ISBN;//书号
private String liuyan;//留言
private String user;//用户名
private String time;//登记时间
public Queshu() {
}
public Queshu(int quesuid, String shu_name, String banshe, String zuozhe, String chuban_date, String ISBN, String liuyan, String user, String time) {
this.quesuid = quesuid;
this.shu_name = shu_name;
this.banshe = banshe;
this.zuozhe = zuozhe;
this.chuban_date = chuban_date;
this.ISBN = ISBN;
this.liuyan = liuyan;
this.user = user;
this.time = time;
}
public int getQuesuid() {
return quesuid;
}
public void setQuesuid(int quesuid) {
this.quesuid = quesuid;
}
public String getShu_name() {
return shu_name;
}
public void setShu_name(String shu_name) {
this.shu_name = shu_name;
}
public String getBanshe() {
return banshe;
}
public void setBanshe(String banshe) {
this.banshe = banshe;
}
public String getZuozhe() {
return zuozhe;
}
public void setZuozhe(String zuozhe) {
this.zuozhe = zuozhe;
}
public String getChuban_date() {
return chuban_date;
}
public void setChuban_date(String chuban_date) {
this.chuban_date = chuban_date;
}
public String getISBN() {
return ISBN;
}
public void setISBN(String ISBN) {
this.ISBN = ISBN;
}
public String getLiuyan() {
return liuyan;
}
public void setLiuyan(String liuyan) {
this.liuyan = liuyan;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
@Override
public String toString() {
return "Queshu{" + "quesuid=" + quesuid + ", shu_name=" + shu_name + ", banshe=" + banshe + ", zuozhe=" + zuozhe + ", chuban_date=" + chuban_date + ", ISBN=" + ISBN + ", liuyan=" + liuyan + ", user=" + user + ", time=" + time + '}';
}
}
Queshu这个类 的 第一个参数是 int 类型吧, temp[0] 是String 类型,当然不能直接将 String传递给 int类型了
你如果能够确保 temp[0] 是个数字字符串,可以用 Integer.parseInt(temp[0]) 转换一下
Queshu是什么鬼,它的构造函数怎么写的。