Solved

Usnig Java Interfaces in ColdFusion

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
The purpose of this video is to demonstrate how to properly insert a Vimeo Video into a WordPress site or Blog. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…

896 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now