日期:2014-05-17  浏览次数:20621 次

一个小小的错误,高手帮忙啊
An error occurred at line: 27 in the jsp file: /articleDetail.jsp
The method initFromRs(ResultSet) is undefined for the type Article
24:  
25: if(rs.next()){
26: a=new Article();
27: a.initFromRs(rs);
28: }
29: DB.close(rs);
30: DB.close(stmt);
public void initFromRs(ResultSet rs) {
try {
setId(rs.getInt("id"));
setPid(rs.getInt("pid"));
setRootid(rs.getInt("rootid"));
setTitle(rs.getString("title"));
setIsleaf(rs.getInt("isleaf") == 0 ? true : false);
setPdate(rs.getTimestamp("pdate"));
setCont(rs.getString("cont"));
setGrade(0);
} catch (SQLException e) {
e.printStackTrace();
}
}
找了半天,还是不知道问题出在那里?

------解决方案--------------------
The method initFromRs(ResultSet) is undefined for the type Article

说明白了就是
a.initFromRs(rs);错了

看看传的参数是不是该是ResultSet

------解决方案--------------------
把这个方法发出来看看initFromRs()
------解决方案--------------------
或者是static 你用对象在调用