Solved

Usnig Java Interfaces in ColdFusion

Posted on 2008-09-30
1
254 Views
Last Modified: 2013-12-24
Below i my attempt to use the java interface java.util.Enumeration.  Because it is an interface and cannot be instantiated the code fails with the error:

Unable to find a constructor for class java.util.Enumeration that accepts parameters of type ( '' ).


How do I correct this.
If (IsDefined('URL.oid') and IsDefined('URL.crgid')) {
	if (Not IsDefined('Session.HtCreativeGroups')){
		ht = createObject('java','java.util.Hashtable').init();
		Session.HtCreativeGroups = ht;
	}
	Session.HtCreativeGroups.put(URL.oid, URL.crgid);
	keys = createObject('java','java.util.Enumeration').init();
	keys = Session.HtCreativeGroups.keys();
	while ( keys.hasMoreElements() )
 			{ 
 				key =  JavaCast("keys.nextElement()", String);
 				creativeGroup =  JavaCast("Session.HtCreativeGroups.get(key)", String);
 				writeOutput( key & " " & creativeGroups );
 				writeOutput("<BR>");
 			} 
	
}

Open in new window

0
Comment
Question by:onaled777
1 Comment
 

Accepted Solution

by:
onaled777 earned 0 total points
ID: 22606029
Solution Below:
		If (IsDefined('URL.oid') and IsDefined('URL.crgid')) {
			if (Not IsDefined('Session.HtCreativeGroups')){
				ht = createObject('java','java.util.Hashtable').init();
				Session.HtCreativeGroups = ht;
			}
			Session.HtCreativeGroups.put(URL.oid, URL.crgid);
			keys = Session.HtCreativeGroups.keys();
			while ( keys.hasMoreElements() )
   			{ 
   				key = keys.nextElement();
   				creativeGroup =  Session.HtCreativeGroups.get(key);
   				writeOutput( key & " " & creativeGroup );
   				writeOutput("<BR>");
   			} 
			
		}

Open in new window

0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Google Crawl Errors Producing 404 Errors 4 84
Build and evolve an interactive experience 1 96
PHP Register global 21 96
move expression web site to a new server 13 53
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question