Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Usnig Java Interfaces in ColdFusion

Posted on 2008-09-30
1
Medium Priority
?
261 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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Open Page or Post…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
Suggested Courses

927 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