• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can we use Hashtable or Vector in a JSP page?  RSS feed

 
archana vishwanath
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friends,

I recently used Vector and Hashtable in my JSP page.Though it works fine
my JSP page has become dead slow,especially in compilation time.

Then I got a doubt,weather it's legal to use Vectors,Hashtables or any other Collections in JSP pages.Please advice me wheather its a right thing to use Vectors or Hashtables in JSP pages.
 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes it legal to use any type of Collection. This is a performance issue. You should think over your application design. Are you fetching Records from Database in these Collections or something else. If you are fetching database records and there a lot of records in the database then obviously it gets slower. Bring the only records from database that you need.

If this is not the problem then explain.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For performance reasons it's far preferred to use other collections like ArrayLists and HashMaps.

I've timed ArrayList vs Vector myself and using ArrayList was a factor 10 faster if not more in accesstime.

(Simply replacing Vector with ArrayList yielded that much improvement).
 
Srinivas Gogineni
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ,
if you are using Vector / hash table both of them are synchronized ,so these two collections will have some over head.based on your requirement u can use hash map/arry list which are not synchronized and will give u better performance.

Thx and Regards
-Srini
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!