• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

performance issue of Vector

 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I have a webpage. where i am displaying my data in a jsp page. i have used Vector to fetch the data from the databases.

But once when more number of users try to access the page.. the Vector doesnt work.

is it a better or good way to use vector in webpages.
pls reply
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should use an ArrayList instead of a Vector but that shouldn't cause problems. What exactly does "does not work" mean"? How are you using the Vector? Could you give us a code snippet or two?
 
Ramesh Shanmugam
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sir,

I have a JSP page. from there i am accessing a java File. There i will fetch the Data's from the DB and set it into a Vector and pass the same to the JSP page for the Display.

The method in the java file is not synchronised.

when the page gets more number of hits .. then the array returned in empty
vector[] and so i am getting a exception in the JSP page.
(why bcos i am accessing the Vector in the JSP to show up data's) so when a null vector is access using vector.get(i) (where i is loop variable)

i am getting "java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 1 "

Exception

can u pls help me out???

Thanks
 
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I dont think it is a vector performance issue. can you pls paste the code snippet and a scenario in which it fails???
 
Thomas Paul
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is the Vector static or an instance variable of the servlet? Without some code snippets I don't think we will be able to help.
 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
...just forget Vector, use ArrayList instead, and post your code.

Giovanni
 
How do they get the deer to cross at the signs? Or to read this tiny ad?
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic