java.lang.NullPointerException www.goods.sech(goods.java:26)

红土村2022-10-04 11:39:541条回答

java.lang.NullPointerException www.goods.sech(goods.java:26) org.apache.jsp.Success_jsp._jspService
public goods sech(){
goods goods=null;
con=conn.getcon();
try {
String sql2 ="select * from wareTable where wareName='yyyyyy'";
pt = con.prepareStatement(sql2);
rs = pt.executeQuery();
while (rs.next()) {
goods.setWareName(rs.getString(1));
goods.setWareSort(rs.getInt(2));
goods.setWareAmount(rs.getInt(3));
}这里是第26行,头痛的就是这里,
}
catch (SQLException ex) {
ex.printStackTrace();
System.out.println("查询失败!");
}finally{
conn.closeset(rs);
conn.closestate(pt);
conn.closeCon(con);
}
return goods;
}
前面是指针异常错误的事件,但不知道那里错了,
java.lang.NullPointerException
www.goods.sech(goods.java:26)
org.apache.jsp.Success_jsp._jspService(Success_jsp.java:58)

已提交,审核后显示!提交回复

共1条回复
rx408 共回答了16个问题 | 采纳率100%
在while(rs.next()){
goods = new Goods();
}
1年前

相关推荐

java.lang.NullPointerException at dao.booDAO.addbook(booDAO.
java.lang.NullPointerException at dao.booDAO.addbook(booDAO.java:23) at org.apache.jsp.addbookok_js
mickey63121年前1
wxyrxq 共回答了18个问题 | 采纳率72.2%
你的booDAO对象为null
检查你的代码
They are the white pointer,the tiger shark,the bull shark an
They are the white pointer,the tiger shark,the bull shark and the white tip.翻译
fengdyj1年前10
五月的月光 共回答了17个问题 | 采纳率94.1%
噬人鲨,虎鲨,白真鲨,白鳍鲨
Mrs Lee and Mr.Pointer,____teachers,are standing as candidat
Mrs Lee and Mr.Pointer,____teachers,are standing as candidates in the next election.A.them b...
Mrs Lee and Mr.Pointer,____teachers,are standing as candidates in the next election.
A.them both.B.them all.C.both of them D.all of them.为什么不选a?
dw8cae1年前1
敬辉 共回答了24个问题 | 采纳率95.8%
不可以说them both,可以说they both are teachers.
答案应该是 c 吧
英语翻译[in] Pointer to a null-terminated string that specifies
英语翻译
[in] Pointer to a null-terminated string that specifies the window name.If the window style specifies a title bar,the window title pointed to by lpWindowName is displayed in the title bar.When using CreateWindow to create controls,such as buttons,check boxes,and static controls,use lpWindowName to specify the text of the control.When creating a static control with the SS_ICON style,use lpWindowName to specify the icon name or identifier.To specify an identifier,use the syntax "#num".
翻译好后
雨郁1年前1
irisatedcat 共回答了10个问题 | 采纳率90%
[在]指向一个空结束的字符串,指定窗口的名称.如果窗口样式指定一个标题栏,窗口标题指向lpWindowName是在标题栏中显示.当使用CreateWindow创建如按钮,复选框控制和静态控制,使用lpWindowName来指定控件的文本.当创建一个与SS_ICON式静态控制,使用lpWindowName来指定图标的名称或标识.要指定一个标识符,使用语法“#数量”.
英语翻译A pointer to the array of command IDs of the buttons to
英语翻译
a pointer to the array of command ids of the buttons to insert.
the zero-based index of the *** image that was added if the method is successful;
a boolean value that specifies whether to associate the existing button images with the inserted buttons
海棠春睡1231年前1
dongwanzhy 共回答了17个问题 | 采纳率88.2%
一个指向数组的指针,数组包含一组待插入按钮的命令的ID.
以零为基准的工具栏图像索引.如果方法成功,则此索引被添加;
一个布尔值,它确定是否将待插入按钮与现有的按钮图像相关联
java.lang.NullPointerException at dao.booDAO.addbook(booDAO.
java.lang.NullPointerException at dao.booDAO.addbook(booDAO.java:23) at org.apache.jsp.addbookok_js
边走边照1年前1
Limitations 共回答了23个问题 | 采纳率82.6%
空指针异常:
在dao包下booDAO类的addbook()方法中.
你可能声明某变量,但未赋值,或者赋了空值.
从你这方法名看,应该是往数据库中插值.
你先检查book对象中的值是否存在!
VC++6.0下Warning:comparison between pointer and integer Error
VC++6.0下Warning:comparison between pointer and integer Error:too few arguments to function ‘feof
这个警告和错误一般来说是什么意思.如何解决,大体说一下.
waterstoneyy1年前1
xuzhisheng43 共回答了18个问题 | 采纳率88.9%
说明你调用函数feof时参数有问题,参数个数或类型
英语翻译That is called pointer-definition operation.Also,there i
英语翻译
That is called pointer-definition operation.Also,there is the operation that does the opposite — to any type of X,which is a pointer,you can add an ampersand — that will result in a type &X,to which refers X.That is called a dereference operation.
win2571年前2
方白牙 共回答了25个问题 | 采纳率80%
这就是所谓的指针定义操作.此外,还有的操作是相反的-任何X,这是一个指针,你可以添加一个符号类型- 这将导致一个类型及X,是指以被称为X上取值操作