首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

一个小小的异常,高手帮忙

2012-04-26 
一个小小的错误,高手帮忙啊An error occurred at line: 27 in the jsp file: /articleDetail.jspThe metho

一个小小的错误,高手帮忙啊
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 你用对象在调用

热点排行