| Author |
In Collection Vector problem
|
mamidi venkat
Ranch Hand
Joined: Jul 03, 2007
Posts: 62
|
|
HI ALL, Vector vtBB1= (Vector)request.getAttribute("vtBB1"); here iam getting object from the database and converting it to Vector firs time its showing null whenever i open the page i.e System.out.println(vtBB1); My problem here is int i=vtBB1.size(); whenever iam checking the condition(i<=0) its showing null pointer exception in jboss server.how to reslove this.
|
 |
suresh mulagala
Ranch Hand
Joined: Feb 18, 2003
Posts: 41
|
|
There could be many reasons why the vector is null in the request. Check if you are doing the setAttribute properly in the page where you are setting on to the request. Its clearly screaming that vtBB1 is null and you need to find out why....
|
 |
Jaikiran Pai
Marshal
Joined: Jul 20, 2005
Posts: 8142
|
|
At this point, this looks more like a JiG(B) or a Servlet question, than a JBoss question. Going by your
Vector vtBB1= (Vector)request.getAttribute("vtBB1");
code, i believe this will make more sense in the Servlets forum. Moving it there.
|
[My Blog] [JavaRanch Journal]
|
 |
Gaurav Sharma
Greenhorn
Joined: Jan 30, 2007
Posts: 28
|
|
Hi Its obvious that if null "Object" is returned from Database then checking the size of null will definetly return "NullPpointerException". Then please check if vtBB1 is not null then only check for its size. Rest you can code what I have written. Please correct me If i am wrong! Cheers! Gaurav
|
 |
suresh mulagala
Ranch Hand
Joined: Feb 18, 2003
Posts: 41
|
|
|
i would have thought that you are trying to retrive the vectory from the request and not the database...wise to see where you are putting in the request properly..
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
Originally posted by Jaikiran Pai: At this point, this looks more like a JiG(B) or a Servlet question, than a JBoss question. Going by your code, i believe this will make more sense in the Servlets forum. Moving it there.
Moving
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
 |
|
|
subject: In Collection Vector problem
|
|
|