aspose file tools*
The moose likes Applets and the fly likes howto: print records from Hashtable? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "howto: print records from Hashtable?" Watch "howto: print records from Hashtable?" New topic
Author

howto: print records from Hashtable?

achana chan
Ranch Hand

Joined: Jul 29, 2002
Posts: 277
Hi.
This probably sounds like a silly question because it is one, but I don't know how to do it.
Here is the code which inserts records into a Hashtable

And here is the client applet code snippet which calls the insertTXRecord() public method to insert a records and then calls the getTXRecord() to try and print it (for testing only);

At the moment, Java console is giving me this output:

system datetime stamp: Mar 3, 2004 3:00:03 PM
TXRecord: java.util.Hashtable$Enumerator@1531164

which is not what I want and doesn't make much sense to me.
TIA :-)


humanum errare est.
jeroen riezebeek
Greenhorn

Joined: Nov 26, 2002
Posts: 9

Returns Enumeration wich is a collection of the elements in the tbl_TXRecords.
To print these element.
achana chan
Ranch Hand

Joined: Jul 29, 2002
Posts: 277
Hi. Thanks for taking time to look at my issue and for the code.

However Java console throws this runtime error:

system datetime stamp: Mar 3, 2004 6:34:58 PM
TXRecord size: 1
getApplet exception: null
java.lang.ClassCastException at ConfirmationFrame$prdDtlActionListener.actionPerformed(ConfirmationFrame.java:341)

It's complaining about casting enum.nextElement() as a Hashtable ?
TIA :-)
achana chan
Ranch Hand

Joined: Jul 29, 2002
Posts: 277
But then, my technique doesn't work either

Throws compile time error

cannot resolve symbol
method get(java.lang.Object)
class TXRecord
.........System.out.println(obj + ": " + (Hashtable)txrecord.get(obj));

Same old nemesis, canna resolve symbol... :-(
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: howto: print records from Hashtable?