prk_usa
asked on
string to HashMap error Java
Hi All,
I am having issues with this , I hope u guys can help me out
<% java.util.HashMap searchHash = new java.util.HashMap();%>
<%String selectedvalue = request.getParameter("var" ); //
String selectedfield = request.getParameter("sele ctedfield" );%>
<% searchHash.put(selectedfie ld,selecte dvalue);
System.out.println("value: "+(java.ut il.HashMap )searchHas h.get(sele ctedfield) ); /// ERROR , java.lang.ClassCastExcepti on
Can you tell me why? I am really confused
Thanks in advance
I am having issues with this , I hope u guys can help me out
<% java.util.HashMap searchHash = new java.util.HashMap();%>
<%String selectedvalue = request.getParameter("var"
String selectedfield = request.getParameter("sele
<% searchHash.put(selectedfie
System.out.println("value:
Can you tell me why? I am really confused
Thanks in advance
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> because I have to pass thi into a function, and that function accepts
then just pass your hashmap, eg.
myMethod(searchHash);
then just pass your hashmap, eg.
myMethod(searchHash);
ASKER
oh ok , I will try it out and let you know and Thanks for your response.
I really appreciate.
I really appreciate.
ASKER
I am not following you, I am sorry.
but
searchHash.get(selectedfie
I want this to be type casted to HashMap , because I have to pass thi into a function, and that function accepts
HashMap only