Solved

Usnig Java Interfaces in ColdFusion

Posted on 2008-09-30
1
252 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Are date-time stamps in Microsoft IIS log files in GMT +0? 3 59
Citrix Web Interface 5.4 logon section customization 2 81
Internal DNS Zone Issue 13 73
http to https 3 61
In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…

770 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