• Post Reply Bookmark Topic Watch Topic
  • New Topic

In Collection Vector problem  RSS feed

 
mamidi venkat
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Gaurav Sharma
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!