jQuery in Action, 2nd edition
The moose likes Beginning Java and the fly likes why i can't get the hashtable value printed? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "why i can Watch "why i can New topic
Author

why i can't get the hashtable value printed?

Meir Yan
Ranch Hand

Joined: Apr 27, 2006
Posts: 597
hello all
i have simple hashtable i can get the keys but i cant get the values
why?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16479
    
    2

Copying the request.getParameterMap() into your own Hashtable is just obfuscation, you could work directly with the Map. However your problem is that the values of that Map are string arrays and not strings, so your code will throw a ClassCastException.
Meir Yan
Ranch Hand

Joined: Apr 27, 2006
Posts: 597
Hello and thank for the fast reply , what do you mean by working directlly
with the map , and how can i convert the string array to string ?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16479
    
    2

Originally posted by Meir Yan:
Hello and thank for the fast reply , what do you mean by working directlly
with the map , and how can i convert the string array to string ?
You use a Map exactly in the same way you were using that Hashtable, only without all the obsolete classes. I think you have been reading examples that are several years old.And how can you convert the string array to a string? Well, why would you want to do that? It's a string array for a reason.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: why i can't get the hashtable value printed?
 
Similar Threads
Servlet becomming slow
Servlet becomming slow
Calling JNDI from JSP
nend some help..
is there any way to pass objects throw http params ?