• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help with NullPointerException

 
priya balakumar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi:

I'm using enumeration to retrieve the datas obtained from the database.
For example I've done like this:


The A class:

1) Enumeration enum=SOME CLASS.getSQL()---------->this function uses the SQL query to get the datas from the database.

2) while(enum.hasMoreElements()){
B bb=(B)enum.nextElement();
<%=bb.getid()%>
}

where B is a second class which gets the datas.

3)The B class:

protected int editionid=0;
public static B(){}
public static B(ResultSet rs){
editionid=rs.getint(1);
}

public int getid(){
return editionid;
}


I've given a sample of code I've written. When I try to run the pgm, It says "NULL POINTER EXCEPTION".

I think the values passed from the A class can't reach B class constructor and that's why the resultset is not displaying the data.

Could anyone help me in solving this.

Replies would be appreciated.

Thanks in Advance.
[ June 25, 2004: Message edited by: Bear Bibeault ]
 
Jakob Jenkov
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to be a little more specific than that. Post the complete stack trace of the NullPointerException in the forum, then we can see what's going on.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65680
129
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
priya, "Help needed" is not a very good subject topic. If you want people to take the time to help you, please take the time to choose a descriptive topic subject. I've edited your post to be a bit more descriptive.

Also, this really has nothing to do with JSP so I'm moving it off to the JDBC forum.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!