?public item itemmessage1(int id ){??Connection conn=null;???PreparedStatement st=null;??ResultSet rs=null;??try {???conn=user.getconnection();???String sql="select * from chongqing where id=?;";???st=(PreparedStatement) conn.prepareStatement(sql);???st.setInt(1, id);???rs=st.executeQuery();???if(rs.next())???{????item it=new item();????it.setId(rs.getInt("id"));????it.setName(rs.getString("name"));????it.setPrice(rs.getDouble("price"));????it.setPicture(rs.getString("picture"));????return it;???}else???{????return null;???}????} catch (Exception e) {??????return null;??}finally{???if(rs!=null)???{????try {?????rs.close();?????rs=null;????} catch (SQLException e) {?????// TODO Auto-generated catch block?????e.printStackTrace();????}????if(st!=null)????{?????try {??????st.close();??????st=null;?????} catch (SQLException e) {??????// TODO Auto-generated catch block??????e.printStackTrace();?????}???}??}????}}item it=read1.itemmessage1(Integer.parseInt(request.getParameter("id")));這句話出現(xiàn)了java.lang.NumberFormatException: null求大神解決
添加回答
舉報(bào)
0/150
提交
取消