aspose file tools*
The moose likes JSP and the fly likes Matching two map values : An exception occured trying to convert String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Matching two map values : An exception occured trying to convert String "A" to type "java.lang.Long"" Watch "Matching two map values : An exception occured trying to convert String "A" to type "java.lang.Long"" New topic
Author

Matching two map values : An exception occured trying to convert String "A" to type "java.lang.Long"

Romeo Ranjan
Ranch Hand

Joined: Feb 23, 2009
Posts: 95
Dear all,

Below is the code that I am working on. I want to loop through the values of the hashmap "a" . If the value of map "a" matches the value of map "a1". I want to print the corresponding key "hello" in hashmap a1.



But this is the error that I get



What do I do in order to rectify the exception. And how do I get the "hello" displayed in the jsp page?


SCJP 6.0
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I'd assume there's some type coercion going on here, thus the error.
Bhoomika Bathla
Ranch Hand

Joined: Nov 28, 2009
Posts: 40
Hello.....

I run your code in eclipse......it does not show any exception.
anbuselvan angamuthu
Greenhorn

Joined: Jul 31, 2010
Posts: 2
i guess you put integer value "new Integer(3)" in a1 map.so you put "new Integer(3)" instant of "new String(3)"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Matching two map values : An exception occured trying to convert String "A" to type "java.lang.Long"